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.
This commit is contained in:
David Leeds 2018-11-19 19:35:36 -08:00 committed by Yu Watanabe
parent 012c2f761b
commit 53640e6fb9

View file

@ -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);
}