]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
service: refuse using PID 1 as MAINPID for a service 5493/head
authorLennart Poettering <lennart@poettering.net>
Tue, 28 Feb 2017 15:08:40 +0000 (16:08 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 28 Feb 2017 15:08:40 +0000 (16:08 +0100)
src/core/service.c

index 5bc8df3e1c1e8ddf546e0b1f82ab3210406d6596..74054887b94bcafe8564fde58d8e3ddbecd8fadf 100644 (file)
@@ -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);