From e31b9ab08892058eea5461eec13b87e1489ac405 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 14 Nov 2007 13:45:20 +0000 Subject: If we have specified a pidfile then we only stop the pid listed, regardless of other arguments. --- src/start-stop-daemon.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/start-stop-daemon.c b/src/start-stop-daemon.c index b0f2fabf..6bdf145a 100644 --- a/src/start-stop-daemon.c +++ b/src/start-stop-daemon.c @@ -292,11 +292,14 @@ static int do_stop (const char *exec, const char *cmd, pid_t pid = 0; int i; - if (pidfile) + if (pidfile) { if ((pid = get_pid (pidfile, quiet)) == -1) return (quiet ? 0 : -1); + pids = rc_find_pids (NULL, NULL, 0, pid); + } else + pids = rc_find_pids (exec, cmd, uid, pid); - if ((pids = rc_find_pids (exec, cmd, uid, pid)) == NULL) + if (! pids) return (0); for (i = 0; pids[i]; i++) { @@ -1022,19 +1025,13 @@ int start_stop_daemon (int argc, char **argv) } else { if (pidfile) { /* The pidfile may not have been written yet - give it some time */ - if (get_pid (pidfile, true) == -1) { + if (get_pid (pidfile, true) == -1) alive = true; - } else { + else nloopsp = 0; - if (do_stop (NULL, NULL, pidfile, uid, 0, - true, false, true) > 0) - alive = true; - } - } else { - if (do_stop (exec, cmd, NULL, uid, 0, true, false, true) - > 0) - alive = true; } + if (do_stop (exec, cmd, pidfile, uid, 0, true, false, true) > 0) + alive = true; } if (! alive) -- cgit v1.2.3