1 |
commit: 97a254f599db622d34a0c1bbd3057d1a7050a468 |
2 |
Author: Doug Freed <dwfreed <AT> mtu <DOT> edu> |
3 |
AuthorDate: Wed Nov 29 20:10:39 2017 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 29 21:53:42 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=97a254f5 |
7 |
|
8 |
start-stop-daemon: properly handle missing pidfile |
9 |
|
10 |
X-Gentoo-Bug: 639218 |
11 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/639218 |
12 |
|
13 |
src/rc/start-stop-daemon.c | 9 ++++++++- |
14 |
1 file changed, 8 insertions(+), 1 deletion(-) |
15 |
|
16 |
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c |
17 |
index e98f8ba3..54b89b2a 100644 |
18 |
--- a/src/rc/start-stop-daemon.c |
19 |
+++ b/src/rc/start-stop-daemon.c |
20 |
@@ -657,8 +657,15 @@ int main(int argc, char **argv) |
21 |
parse_schedule(applet, "0", sig); |
22 |
else |
23 |
parse_schedule(applet, NULL, sig); |
24 |
+ if (pidfile) { |
25 |
+ pid = get_pid(applet, pidfile); |
26 |
+ if (pid == -1) |
27 |
+ exit(EXIT_FAILURE); |
28 |
+ } else { |
29 |
+ pid = 0; |
30 |
+ } |
31 |
i = run_stop_schedule(applet, exec, (const char *const *)margv, |
32 |
- get_pid(applet, pidfile), uid, test, progress, false); |
33 |
+ pid, uid, test, progress, false); |
34 |
|
35 |
if (i < 0) |
36 |
/* We failed to stop something */ |