Blame 0001-service-minor-change-in-service_load_pid_file-return.patch
|
|
a1c89c5 |
From 13230d5d3c89e866f1b9b689d41f0edc90af707a Mon Sep 17 00:00:00 2001
|
|
|
a1c89c5 |
From: Michal Schmidt <mschmidt@redhat.com>
|
|
|
a1c89c5 |
Date: Wed, 21 Sep 2011 02:25:17 +0200
|
|
|
a1c89c5 |
Subject: [PATCH] service: minor change in service_load_pid_file return value
|
|
|
a1c89c5 |
|
|
|
a1c89c5 |
Return 0 only if the PID was really loaded. If no PIDFile= is defined,
|
|
|
a1c89c5 |
return -ENOENT.
|
|
|
a1c89c5 |
|
|
|
a1c89c5 |
Only one caller cares about the return value of this function and this
|
|
|
a1c89c5 |
change makes the usage nicer.
|
|
|
a1c89c5 |
---
|
|
|
a1c89c5 |
src/service.c | 4 ++--
|
|
|
a1c89c5 |
1 files changed, 2 insertions(+), 2 deletions(-)
|
|
|
a1c89c5 |
|
|
|
a1c89c5 |
diff --git a/src/service.c b/src/service.c
|
|
|
a1c89c5 |
index 8f827aa..5050bca 100644
|
|
|
a1c89c5 |
--- a/src/service.c
|
|
|
a1c89c5 |
+++ b/src/service.c
|
|
|
a1c89c5 |
@@ -1270,7 +1270,7 @@ static int service_load_pid_file(Service *s) {
|
|
|
a1c89c5 |
assert(s);
|
|
|
a1c89c5 |
|
|
|
a1c89c5 |
if (!s->pid_file)
|
|
|
a1c89c5 |
- return 0;
|
|
|
a1c89c5 |
+ return -ENOENT;
|
|
|
a1c89c5 |
|
|
|
a1c89c5 |
if ((r = read_one_line_file(s->pid_file, &k)) < 0)
|
|
|
a1c89c5 |
return r;
|
|
|
a1c89c5 |
@@ -2585,7 +2585,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
|
|
a1c89c5 |
/* Forking services may occasionally move to a new PID.
|
|
|
a1c89c5 |
* As long as they update the PID file before exiting the old
|
|
|
a1c89c5 |
* PID, they're fine. */
|
|
|
a1c89c5 |
- if (s->pid_file && service_load_pid_file(s) == 0)
|
|
|
a1c89c5 |
+ if (service_load_pid_file(s) == 0)
|
|
|
a1c89c5 |
return;
|
|
|
a1c89c5 |
|
|
|
a1c89c5 |
s->main_pid = 0;
|
|
|
a1c89c5 |
--
|
|
|
a1c89c5 |
1.7.4.4
|
|
|
a1c89c5 |
|