install: allow removing symlinks even for units that are gone
authorLuca Boccassi <bluca@debian.org>
Fri, 7 Jun 2024 20:39:45 +0000 (21:39 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 18 Jun 2024 18:41:01 +0000 (20:41 +0200)
commitc26e56d08f30a2946dfa1d03781c63bfa9f56c1d
treeb19ceba19e336e793d27a08f785c81bdaa36b28a
parenta776dcf7af3b189f4f9616d174dbfc53a9bd6db6
install: allow removing symlinks even for units that are gone

If a symlink is leftover, still allow cleaning it up via 'disable'. This
happens when a unit is stopped and removed, but not disabled, and a reload
has already happened. At that point, cleaning up the old symlinks becomes
impossible through the APIs, and needs to be done manually. Always allow
cleaning up symlinks, if they exist, by only erroring out if there is an
OOM.

Follow-up for f31f10a6207efc9ae9e0b1f73975b5b610914017

(cherry picked from commit 5163c9b1e56293b1bb2803420613c5b374570892)
src/shared/install.c
test/units/TEST-26-SYSTEMCTL.sh