Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/
Date: Mon, 07 May 2018 23:21:06
Message-Id: 1525286579.0200002b8cbd061ac79b6aed4024220cd0386d2c.williamh@OpenRC
1 commit: 0200002b8cbd061ac79b6aed4024220cd0386d2c
2 Author: Andrey Utkin <andrey_utkin <AT> gentoo <DOT> org>
3 AuthorDate: Sat Apr 21 22:13:15 2018 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Wed May 2 18:42:59 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=0200002b
7
8 start-stop-daemon: don't fail stopping if pidfile is gone
9
10 If pidfile does not exist when we are stopping the daemon, assume it is
11 already stopped, and report success.
12
13 hostapd is an example of a daemon which removes its pidfile when it is
14 exiting. If this daemon terminates prematurely, that is, without s-s-d
15 involvement, then openrc fails to restart it, because s-s-d "stop"
16 command fails when pidfile is missing.
17
18 X-Gentoo-Bug: 646274
19 X-Gentoo-Bug-URL: https://bugs.gentoo.org/646274
20
21 src/rc/start-stop-daemon.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24 diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c
25 index 1b565829..0b3b423f 100644
26 --- a/src/rc/start-stop-daemon.c
27 +++ b/src/rc/start-stop-daemon.c
28 @@ -661,7 +661,7 @@ int main(int argc, char **argv)
29 parse_schedule(applet, NULL, sig);
30 if (pidfile) {
31 pid = get_pid(applet, pidfile);
32 - if (pid == -1)
33 + if (pid == -1 && errno != ENOENT)
34 exit(EXIT_FAILURE);
35 } else {
36 pid = 0;