summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IcePack/IcePackNode.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/cpp/src/IcePack/IcePackNode.cpp b/cpp/src/IcePack/IcePackNode.cpp
index dde17b3d56f..44f1bfd96a4 100644
--- a/cpp/src/IcePack/IcePackNode.cpp
+++ b/cpp/src/IcePack/IcePackNode.cpp
@@ -77,13 +77,20 @@ childHandler(int)
// process and avoid zombie processes. See man wait or waitpid for
// more information.
//
- pid_t childPid;
+ int olderrno = errno;
+
+ pid_t pid;
do
- {
- int status;
- childPid = waitpid(-1, &status, WNOHANG);
- } while(childPid > 0);
+ {
+ pid = waitpid(-1, 0, WNOHANG);
+ }
+ while(pid > 0);
+
+ assert(pid != -1 || errno == ECHILD);
+
+ errno = olderrno;
}
+
}
#endif