aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-11-14 13:45:20 +0000
committerRoy Marples <roy@marples.name>2007-11-14 13:45:20 +0000
commite31b9ab08892058eea5461eec13b87e1489ac405 (patch)
treea896618603df50622dfc272fadb823764d22a665
parentccf79ceb475d94236acca378e079625ef511eda2 (diff)
If we have specified a pidfile then we only stop the pid listed,
regardless of other arguments.
-rw-r--r--src/start-stop-daemon.c21
1 files changed, 9 insertions, 12 deletions
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)