From 53640e6fb916f0a3651df45bb7970d76caed4895 Mon Sep 17 00:00:00 2001 From: David Leeds Date: Mon, 19 Nov 2018 19:35:36 -0800 Subject: [PATCH] process-util: check for correct kill return value (#10841) Code was not doing a wait() after kill() due to checking for a return value > 0, and was leaving zombie processes. This affected things like sd-bus unixexec connections. --- src/basic/process-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/basic/process-util.c b/src/basic/process-util.c index b3f69b2542b..8f7f4b5e25e 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -831,7 +831,7 @@ int wait_for_terminate_with_timeout(pid_t pid, usec_t timeout) { void sigkill_wait(pid_t pid) { assert(pid > 1); - if (kill(pid, SIGKILL) > 0) + if (kill(pid, SIGKILL) >= 0) (void) wait_for_terminate(pid, NULL); } @@ -849,7 +849,7 @@ void sigkill_waitp(pid_t *pid) { void sigterm_wait(pid_t pid) { assert(pid > 1); - if (kill_and_sigcont(pid, SIGTERM) > 0) + if (kill_and_sigcont(pid, SIGTERM) >= 0) (void) wait_for_terminate(pid, NULL); } -- 2.47.3