From fc250931e87ae258d7367e65b2195e359ee72738 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 6 Sep 2014 00:49:28 +0200 Subject: Fix async command waitpid error handling (again...) --- src/fastd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/fastd.c b/src/fastd.c index b1f2457..fcefc6b 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -538,11 +538,14 @@ static inline void reap_zombies(void) { size_t i; for (i = 0; i < VECTOR_LEN(ctx.async_pids);) { pid_t pid = VECTOR_INDEX(ctx.async_pids, i); - if (waitpid(pid, NULL, WNOHANG) > 0) { + + pid_t ret = waitpid(pid, NULL, WNOHANG); + + if (ret > 0) { pr_debug("child process %u finished", (unsigned)pid); } else { - if (errno == ECHILD || errno == EINTR) { + if (ret == 0 || errno == EINTR) { i++; continue; } -- cgit v1.2.3