diff options
author | Andrey Utkin <andrey_utkin@gentoo.org> | 2018-04-21 23:13:15 +0100 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2018-05-02 13:42:59 -0500 |
commit | 0200002b8cbd061ac79b6aed4024220cd0386d2c (patch) | |
tree | b4fb60c01271e337c30823526866d8d632da9ffb | |
parent | f4e2142089487b7f5c99da949d7bf8d038724df7 (diff) |
start-stop-daemon: don't fail stopping if pidfile is gone
If pidfile does not exist when we are stopping the daemon, assume it is
already stopped, and report success.
hostapd is an example of a daemon which removes its pidfile when it is
exiting. If this daemon terminates prematurely, that is, without s-s-d
involvement, then openrc fails to restart it, because s-s-d "stop"
command fails when pidfile is missing.
X-Gentoo-Bug: 646274
X-Gentoo-Bug-URL: https://bugs.gentoo.org/646274
-rw-r--r-- | src/rc/start-stop-daemon.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index 1b565829..0b3b423f 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -661,7 +661,7 @@ int main(int argc, char **argv) parse_schedule(applet, NULL, sig); if (pidfile) { pid = get_pid(applet, pidfile); - if (pid == -1) + if (pid == -1 && errno != ENOENT) exit(EXIT_FAILURE); } else { pid = 0; |