diff options
author | Martin Pitt <martinpitt@users.noreply.github.com> | 2017-02-28 23:23:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-28 23:23:18 +0100 |
commit | 74278ce56732056bb3cc75062113e393db1d6dd2 (patch) | |
tree | d31dfc27d7a3eefa85bd4c42e80c413f6bc892fc | |
parent | b4227dbb452003d17877a9b23d191dc5ccc53138 (diff) | |
parent | 6939ce648aae1bf7e515731c0547a54eb939c259 (diff) |
Merge pull request #5493 from poettering/service-mini-fixes
three small mini-fixes for src/core/service.c
-rw-r--r-- | src/core/service.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core/service.c b/src/core/service.c index 5581ec8b06..74054887b9 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -849,11 +849,8 @@ static int service_load_pid_file(Service *s, bool may_warn) { return r; r = unit_watch_pid(UNIT(s), pid); - if (r < 0) { - /* FIXME: we need to do something here */ - log_unit_warning_errno(UNIT(s), r, "Failed to watch PID "PID_FMT" for service: %m", pid); - return r; - } + if (r < 0) /* FIXME: we need to do something here */ + return log_unit_warning_errno(UNIT(s), r, "Failed to watch PID "PID_FMT" for service: %m", pid); return 0; } @@ -1374,8 +1371,7 @@ static int service_spawn( return r; r = unit_watch_pid(UNIT(s), pid); - if (r < 0) - /* FIXME: we need to do something here */ + if (r < 0) /* FIXME: we need to do something here */ return r; *_pid = pid; @@ -3097,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); @@ -3286,7 +3284,7 @@ static void service_bus_name_owner_change( if (r >= 0) r = sd_bus_creds_get_pid(creds, &pid); if (r >= 0) { - log_unit_debug(u, "D-Bus name %s is now owned by process %u", name, (unsigned) pid); + log_unit_debug(u, "D-Bus name %s is now owned by process " PID_FMT, name, pid); service_set_main_pid(s, pid); unit_watch_pid(UNIT(s), pid); |