From: Nils K <24257556+septatrix@users.noreply.github.com> Date: Tue, 10 Dec 2024 19:48:09 +0000 (+0100) Subject: core: improve finding OnSuccess=/OnFailure= dependent (#35468) X-Git-Tag: v258-rc1~1932 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e76d83d100e0ed35e4d6266da411ce2e265656f4;p=thirdparty%2Fsystemd.git core: improve finding OnSuccess=/OnFailure= dependent (#35468) Previously if one service specified the same unit as their success and failure handler we bailed out of resolving the triggering unit even though it is still unique. --- diff --git a/src/core/service.c b/src/core/service.c index c436650791f..c7c5225115c 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -1648,13 +1648,7 @@ static Service *service_get_triggering_service(Service *s) { * or OnSuccess= then we return NULL. This is since we don't know from which * one to propagate the exit status. */ - UNIT_FOREACH_DEPENDENCY(other, UNIT(s), UNIT_ATOM_ON_FAILURE_OF) { - if (candidate) - goto have_other; - candidate = other; - } - - UNIT_FOREACH_DEPENDENCY(other, UNIT(s), UNIT_ATOM_ON_SUCCESS_OF) { + UNIT_FOREACH_DEPENDENCY(other, UNIT(s), UNIT_ATOM_ON_SUCCESS_OF|UNIT_ATOM_ON_FAILURE_OF) { if (candidate) goto have_other; candidate = other; diff --git a/test/units/TEST-68-PROPAGATE-EXIT-STATUS.sh b/test/units/TEST-68-PROPAGATE-EXIT-STATUS.sh index 11da48aba01..d717ce5a557 100755 --- a/test/units/TEST-68-PROPAGATE-EXIT-STATUS.sh +++ b/test/units/TEST-68-PROPAGATE-EXIT-STATUS.sh @@ -30,7 +30,7 @@ cat >/run/systemd/system/testservice-failure-68.service </run/systemd/system/testservice-failure-68-template.service </run/systemd/system/testservice-failure-68-template.service </run/systemd/system/testservice-success-68.service </run/systemd/system/testservice-success-68.service </run/systemd/system/testservice-success-68-template.service </run/systemd/system/testservice-success-68-template.service </run/systemd/system/testservice-success-and-failure-68.service <