]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: don't pass uninitialzed PIDs to pid_is_unwaited()
authorLennart Poettering <lennart@poettering.net>
Tue, 27 Oct 2015 16:56:12 +0000 (17:56 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 27 Oct 2015 16:56:12 +0000 (17:56 +0100)
Since 5fd9b2c5467b0a42ccdabc7eb8e516d512609a8e passing a pid of 0 to
pid_is_unwaited() and pid_is_live() is considered as a request on the
current process, similar how the other calls in process-util.c handle a
PID of 0. This broke service.c, which passes a 0 PID and expects it to
be considered an unwaited process.

This fix make sure we can boot again.

src/core/service.c

index 31a0d3aebef40f4dcbe6d0adb1c891c590980aca..a7725c52a0228d4938fb05703c265d8764882d33 100644 (file)
@@ -940,7 +940,8 @@ static int service_coldplug(Unit *u) {
                                 return r;
                 }
 
-                if (pid_is_unwaited(s->main_pid) &&
+                if (s->main_pid > 0 &&
+                    pid_is_unwaited(s->main_pid) &&
                     ((s->deserialized_state == SERVICE_START && IN_SET(s->type, SERVICE_FORKING, SERVICE_DBUS, SERVICE_ONESHOT, SERVICE_NOTIFY)) ||
                      IN_SET(s->deserialized_state,
                             SERVICE_START, SERVICE_START_POST,
@@ -952,7 +953,8 @@ static int service_coldplug(Unit *u) {
                                 return r;
                 }
 
-                if (pid_is_unwaited(s->control_pid) &&
+                if (s->control_pid > 0 &&
+                    pid_is_unwaited(s->control_pid) &&
                     IN_SET(s->deserialized_state,
                            SERVICE_START_PRE, SERVICE_START, SERVICE_START_POST,
                            SERVICE_RELOAD,