summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-09-06 00:49:28 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-09-06 00:49:28 +0200
commitfc250931e87ae258d7367e65b2195e359ee72738 (patch)
tree9abeb372c9796f5ba854ddd3c5d36d034f893e71 /src
parent76becb4729581abb27dc23d9909bd390553de7aa (diff)
downloadfastd-fc250931e87ae258d7367e65b2195e359ee72738.tar
fastd-fc250931e87ae258d7367e65b2195e359ee72738.zip
Fix async command waitpid error handling (again...)
Diffstat (limited to 'src')
-rw-r--r--src/fastd.c7
1 files 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;
}