aboutsummaryrefslogtreecommitdiff
path: root/src/start-stop-daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/start-stop-daemon.c')
-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)