summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuxuan Shui <yshuiv7@gmail.com>2014-02-15 13:20:55 +0800
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-02-16 11:09:51 -0500
commite3025da104f96ab428a9121f738c6343964d5260 (patch)
treed2e806f54832f912b2dc105c3e27292dfe99e445
parent5d31974e44b8fa163f859d8467a3667ed52056d0 (diff)
core: check for return value from get_process_state
Fix for commit e10c9985bb.
-rw-r--r--src/core/service.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 3a2ef01570..8e07bd0170 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1376,7 +1376,13 @@ 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.",