chiark / gitweb /
core: check for return value from get_process_state
authorYuxuan Shui <yshuiv7@gmail.com>
Sat, 15 Feb 2014 05:20:55 +0000 (13:20 +0800)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 16 Feb 2014 16:09:51 +0000 (11:09 -0500)
Fix for commit e10c9985bb.

src/core/service.c

index 3a2ef01..8e07bd0 100644 (file)
@@ -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.",