]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
service: prevent registering control pids as the main pid
authorJouke Witteveen <j.witteveen@gmail.com>
Sat, 26 Nov 2016 09:16:47 +0000 (10:16 +0100)
committerJouke Witteveen <j.witteveen@gmail.com>
Tue, 29 Nov 2016 09:34:33 +0000 (10:34 +0100)
We assume a process can be only one of the two in service_sigchld_event.

src/core/service.c

index 39b3589e6ba0b52a42a699e34453e6661d8e2b20..bb67bdf84caa28b0bef037f7db0dac758059e03b 100644 (file)
@@ -3071,6 +3071,8 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags, FDSet *fds)
         if (e && IN_SET(s->state, SERVICE_START, SERVICE_START_POST, SERVICE_RUNNING, SERVICE_RELOAD)) {
                 if (parse_pid(e, &pid) < 0)
                         log_unit_warning(u, "Failed to parse MAINPID= field in notification message: %s", e);
+                else if (pid == s->control_pid)
+                        log_unit_warning(u, "A control process cannot also be the main process");
                 else {
                         service_set_main_pid(s, pid);
                         unit_watch_pid(UNIT(s), pid);