diff options
author | Roy Marples <roy@marples.name> | 2008-02-19 10:18:26 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-02-19 10:18:26 +0000 |
commit | f95e0b2c3e0192b44d6ac792f40a61a34f8c8b13 (patch) | |
tree | 1651c78ee56866039493c290ef643b6277673dcf /src/rc | |
parent | eedf63906dea4f6c139382495a67aeded1c51fe2 (diff) |
We should remove stale pidfiles and service daemon info if we didn't find anything to stop, bug #25.
Diffstat (limited to 'src/rc')
-rw-r--r-- | src/rc/start-stop-daemon.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index d523b7c0..057901e0 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -789,11 +789,18 @@ int start_stop_daemon (int argc, char **argv) result = run_stop_schedule ((const char *const *)argv, cmd, pidfile, uid, quiet, verbose, test); + + if (result < 0) + /* We failed to stop something */ + exit (EXIT_FAILURE); + if (test || oknodo) return (result > 0 ? EXIT_SUCCESS : EXIT_FAILURE); - if (result < 1) - exit (result == 0 ? EXIT_SUCCESS : EXIT_FAILURE); + /* Even if we have not actually killed anything, we should + * remove information about it as it may have unexpectedly + * crashed out. We should also return success as the end + * result would be the same. */ if (pidfile && exists (pidfile)) unlink (pidfile); |