Blame SOURCES/0230-core-check-for-return-value-from-get_process_state.patch
|
|
65878a |
From 54461c902d71e43fd5cc0010e0352903685c3974 Mon Sep 17 00:00:00 2001
|
|
|
65878a |
From: Yuxuan Shui <yshuiv7@gmail.com>
|
|
|
65878a |
Date: Sat, 15 Feb 2014 13:20:55 +0800
|
|
|
65878a |
Subject: [PATCH] core: check for return value from get_process_state
|
|
|
65878a |
|
|
|
65878a |
Fix for commit e10c9985bb.
|
|
|
65878a |
---
|
|
|
65878a |
src/core/service.c | 12 +++++++++---
|
|
|
65878a |
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
65878a |
|
|
|
65878a |
diff --git a/src/core/service.c b/src/core/service.c
|
|
|
65878a |
index 3eacf3b..f6fdbbc 100644
|
|
|
65878a |
--- a/src/core/service.c
|
|
|
65878a |
+++ b/src/core/service.c
|
|
|
65878a |
@@ -1429,11 +1429,17 @@ static int service_load_pid_file(Service *s, bool may_warn) {
|
|
|
65878a |
return -ESRCH;
|
|
|
65878a |
}
|
|
|
65878a |
|
|
|
65878a |
- if (get_process_state(pid) == 'Z') {
|
|
|
65878a |
+ r = get_process_state(pid);
|
|
|
65878a |
+ if (r < 0) {
|
|
|
65878a |
+ if (may_warn)
|
|
|
65878a |
+ log_info_unit(UNIT(s)->id, "Failed to read /proc/%d/stat: %s",
|
|
|
65878a |
+ pid, strerror(-r));
|
|
|
65878a |
+ return r;
|
|
|
65878a |
+ } else if (r == 'Z') {
|
|
|
65878a |
if (may_warn)
|
|
|
65878a |
log_info_unit(UNIT(s)->id,
|
|
|
65878a |
- "PID "PID_FMT" read from file %s is a zombie.",
|
|
|
65878a |
- pid, s->pid_file);
|
|
|
65878a |
+ "PID %lu read from file %s is a zombie.",
|
|
|
65878a |
+ (unsigned long) pid, s->pid_file);
|
|
|
65878a |
return -ESRCH;
|
|
|
65878a |
}
|
|
|
65878a |
|