From 0200002b8cbd061ac79b6aed4024220cd0386d2c Mon Sep 17 00:00:00 2001 From: Andrey Utkin Date: Sat, 21 Apr 2018 23:13:15 +0100 Subject: 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 --- src/rc/start-stop-daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.3