diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-02-28 16:08:40 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-02-28 16:08:40 +0100 |
commit | 6939ce648aae1bf7e515731c0547a54eb939c259 (patch) | |
tree | 10ccd876095603c2518844e09c9cfda3a3479fdd | |
parent | e8b509d3bec0cd32746315cf83c79cc3a7618c9c (diff) |
service: refuse using PID 1 as MAINPID for a service
-rw-r--r-- | src/core/service.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/service.c b/src/core/service.c index 5bc8df3e1c..74054887b9 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -3093,6 +3093,8 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags, FDSet *fds) 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 if (pid == getpid() || pid == 1) + log_unit_warning(u, "Service manager can't be main process, ignoring sd_notify() MAINPID= field"); else { service_set_main_pid(s, pid); unit_watch_pid(UNIT(s), pid); |