From: David Leeds Date: Tue, 20 Nov 2018 03:35:36 +0000 (-0800) Subject: process-util: check for correct kill return value (#10841) X-Git-Tag: v240~273 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=53640e6fb916f0a3651df45bb7970d76caed4895;p=thirdparty%2Fsystemd.git 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. --- 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); }