From 7a5049c780454197c4f03632e67ea735ea803265 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 2 Mar 2022 13:05:50 +0100 Subject: [PATCH] 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. --- src/core/service.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) 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( -- 2.47.3