]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
manager/service: when we have multiple candidates to handle, warn
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 2 Mar 2022 12:05:50 +0000 (13:05 +0100)
committerLuca Boccassi <bluca@debian.org>
Thu, 10 Mar 2022 14:51:28 +0000 (14:51 +0000)
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

index f5fe683cf2f72b199c961e527d9037a08eaa9bb3..942bc7c0ff71f33ae91a2cef9b74f6c329c07001 100644 (file)
@@ -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(