diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-04-04 02:03:35 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-04-04 02:03:35 +0200 |
commit | 929f63e57cadb22905411f212809c14b160ec494 (patch) | |
tree | ea12736cdf8264c81ded5f26ff8ee4f3fd0a990f | |
parent | 6a3e01d5a9f979f7d6e52665c2bf6c74e2592980 (diff) | |
download | busybox-w32-929f63e57cadb22905411f212809c14b160ec494.tar.gz busybox-w32-929f63e57cadb22905411f212809c14b160ec494.tar.bz2 busybox-w32-929f63e57cadb22905411f212809c14b160ec494.zip |
start-stop-daemon: fix "-K --test --pidfile PIDFILE" exitcode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | debianutils/start_stop_daemon.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index 30dd9709d..bc61959d2 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c | |||
@@ -337,11 +337,17 @@ static int do_stop(void) | |||
337 | goto ret; | 337 | goto ret; |
338 | } | 338 | } |
339 | for (p = G.found_procs; p; p = p->next) { | 339 | for (p = G.found_procs; p; p = p->next) { |
340 | if (TEST || kill(p->pid, signal_nr) == 0) { | 340 | if (kill(p->pid, TEST ? 0 : signal_nr) == 0) { |
341 | killed++; | 341 | killed++; |
342 | } else { | 342 | } else { |
343 | p->pid = 0; | ||
344 | bb_perror_msg("warning: killing process %u", (unsigned)p->pid); | 343 | bb_perror_msg("warning: killing process %u", (unsigned)p->pid); |
344 | p->pid = 0; | ||
345 | if (TEST) { | ||
346 | /* Example: -K --test --pidfile PIDFILE detected | ||
347 | * that PIDFILE's pid doesn't exist */ | ||
348 | killed = -1; | ||
349 | goto ret; | ||
350 | } | ||
345 | } | 351 | } |
346 | } | 352 | } |
347 | if (!QUIET && killed) { | 353 | if (!QUIET && killed) { |