From: Zbigniew Jędrzejewski-Szmek Date: Wed, 2 Mar 2022 12:05:50 +0000 (+0100) Subject: manager/service: when we have multiple candidates to handle, warn X-Git-Tag: v251-rc1~175^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a5049c780454197c4f03632e67ea735ea803265;p=thirdparty%2Fsystemd.git manager/service: when we have multiple candidates to handle, warn This would be very confusing to users, so let's warn if they configured the same handler for multiple units and we're not running it as expected. --- diff --git a/src/core/service.c b/src/core/service.c index f5fe683cf2f..942bc7c0ff7 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -1462,24 +1462,23 @@ static Service *service_get_triggering_service(Service *s) { * one to propagate the exit status. */ UNIT_FOREACH_DEPENDENCY(other, UNIT(s), UNIT_ATOM_ON_FAILURE_OF) { - if (candidate) { - log_unit_debug(UNIT(s), "multiple trigger source candidates for exit status propagation, skipping."); - return NULL; - } - + if (candidate) + goto have_other; candidate = other; } UNIT_FOREACH_DEPENDENCY(other, UNIT(s), UNIT_ATOM_ON_SUCCESS_OF) { - if (candidate) { - log_unit_debug(UNIT(s), "multiple trigger source candidates for exit status propagation, skipping."); - return NULL; - } - + if (candidate) + goto have_other; candidate = other; } return SERVICE(candidate); + + have_other: + log_unit_warning(UNIT(s), "multiple trigger source candidates for exit status propagation (%s, %s), skipping.", + candidate->id, other->id); + return NULL; } static int service_spawn_internal(