summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2016-11-26 10:16:47 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2016-11-29 10:34:33 +0100
commit3c9512c71d49d42513755cfa4329275c0360f397 (patch)
tree6b77253437c3eeadbfc8e558782ab4d55d05aab4 /src
parent71e529fcf18c00e4dd51fb46f7f289dc5eb11fbd (diff)
service: prevent registering control pids as the main pid
We assume a process can be only one of the two in service_sigchld_event.
Diffstat (limited to 'src')
-rw-r--r--src/core/service.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 39b3589e6b..bb67bdf84c 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -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);