shared/install: ignore symlinks which have lower priority than the unit file
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 13 Dec 2018 09:46:27 +0000 (10:46 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 13 Dec 2018 09:46:27 +0000 (10:46 +0100)
commit4b37c89f066209490197f680a597af2297ec008c
tree35ec035ceaaba05940169f462906722d44be5e45
parent3e8d06d951d33c463e1efb67501e664f82cf3708
shared/install: ignore symlinks which have lower priority than the unit file

In #10583, a unit file lives in ~/.config/systemd/user, and
'systemctl --runtime --user mask' is used to create a symlink in /run.
This symlink has lower priority than the config file, so
'systemctl --user' will happily load the unit file, and does't care about
the symlink at all.

But when asked if the unit is enabled, we'd look for all symlinks, find the
symlink in the runtime directory, and report that the unit is runtime-enabled.
In this particular case the fact that the symlink points at /dev/null, creates
additional confusion, but it doesn't really matter: *any* symlink (or regular
file) that is lower in the priority order is "covered" by the unit fragment,
and should be ignored.

Fixes #10583.
src/shared/install.c