If we have specified a pidfile then we only stop the pid listed,

regardless of other arguments.
This commit is contained in:
Roy Marples 2007-11-14 13:45:20 +00:00
parent ccf79ceb47
commit e31b9ab088

View File

@ -292,11 +292,14 @@ static int do_stop (const char *exec, const char *cmd,
pid_t pid = 0; pid_t pid = 0;
int i; int i;
if (pidfile) if (pidfile) {
if ((pid = get_pid (pidfile, quiet)) == -1) if ((pid = get_pid (pidfile, quiet)) == -1)
return (quiet ? 0 : -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); return (0);
for (i = 0; pids[i]; i++) { for (i = 0; pids[i]; i++) {
@ -1022,20 +1025,14 @@ int start_stop_daemon (int argc, char **argv)
} else { } else {
if (pidfile) { if (pidfile) {
/* The pidfile may not have been written yet - give it some time */ /* 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; alive = true;
} else { else
nloopsp = 0; nloopsp = 0;
if (do_stop (NULL, NULL, pidfile, uid, 0,
true, false, true) > 0)
alive = true;
} }
} else { if (do_stop (exec, cmd, pidfile, uid, 0, true, false, true) > 0)
if (do_stop (exec, cmd, NULL, uid, 0, true, false, true)
> 0)
alive = true; alive = true;
} }
}
if (! alive) if (! alive)
eerrorx ("%s: %s died", applet, exec); eerrorx ("%s: %s died", applet, exec);