diff options
author | Yuxuan Shui <yshuiv7@gmail.com> | 2014-02-15 13:20:55 +0800 |
---|---|---|
committer | Lukas Nykryn <lnykryn@redhat.com> | 2014-03-14 17:56:20 +0100 |
commit | 4372855b7871dd4f639d0e5fca86eff0d38aeb18 (patch) | |
tree | 503c4a2a5943b10c56e52239af3e9554cea46faf /src/core | |
parent | a4157894c590dc1a976449271be4b6faecf22a28 (diff) |
core: check for return value from get_process_state
Fix for commit e10c9985bb.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/service.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/service.c b/src/core/service.c index d9bc02181..c8dbbeff1 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -1429,11 +1429,17 @@ static int service_load_pid_file(Service *s, bool may_warn) { return -ESRCH; } - if (get_process_state(pid) == 'Z') { + r = get_process_state(pid); + if (r < 0) { + if (may_warn) + log_info_unit(UNIT(s)->id, "Failed to read /proc/%d/stat: %s", + pid, strerror(-r)); + return r; + } else if (r == 'Z') { if (may_warn) log_info_unit(UNIT(s)->id, - "PID "PID_FMT" read from file %s is a zombie.", - pid, s->pid_file); + "PID %lu read from file %s is a zombie.", + (unsigned long) pid, s->pid_file); return -ESRCH; } |