]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
service: don't send out dbus change notifications spuriously on SIGCHLD
authorLennart Poettering <lennart@poettering.net>
Fri, 12 Jan 2018 12:05:07 +0000 (13:05 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 23 Jan 2018 20:22:50 +0000 (21:22 +0100)
Let's send them out only if the main or control processe exited and we
recorded a new exit status that is worth reporting. But if any other
service process died this is nothing to report since we don't expose any
properties about that anyway.

src/core/service.c

index 969e9b4ffcf709d653f07ee9d80d1f6a95036bd9..445f3ff60461b6b0d11319846ecc349e2daf5375 100644 (file)
@@ -3015,6 +3015,7 @@ static void service_notify_cgroup_empty_event(Unit *u) {
 }
 
 static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
+        bool notify_dbus = true;
         Service *s = SERVICE(u);
         ServiceResult f;
 
@@ -3293,10 +3294,12 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
                                 assert_not_reached("Uh, control process died at wrong time.");
                         }
                 }
-        }
+        } else /* Neither control nor main PID? If so, don't notify about anything */
+                notify_dbus = false;
 
         /* Notify clients about changed exit status */
-        unit_add_to_dbus_queue(u);
+        if (notify_dbus)
+                unit_add_to_dbus_queue(u);
 
         /* We got one SIGCHLD for the service, let's watch all
          * processes that are now running of the service, and watch