mirror of
https://github.com/systemd/systemd.git
synced 2025-02-10 17:57:40 +03:00
service: refuse using PID 1 as MAINPID for a service
This commit is contained in:
parent
e8b509d3be
commit
6939ce648a
@ -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);
|
log_unit_warning(u, "Failed to parse MAINPID= field in notification message: %s", e);
|
||||||
else if (pid == s->control_pid)
|
else if (pid == s->control_pid)
|
||||||
log_unit_warning(u, "A control process cannot also be the main process");
|
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 {
|
else {
|
||||||
service_set_main_pid(s, pid);
|
service_set_main_pid(s, pid);
|
||||||
unit_watch_pid(UNIT(s), pid);
|
unit_watch_pid(UNIT(s), pid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user