Merge pull request #3 from jturner/killzombies
Make sure zombie processes are not left over
--- a/pop3d.c Mon Apr 07 12:28:10 2014 +0500
+++ b/pop3d.c Thu Apr 10 18:13:08 2014 +0500
@@ -203,8 +203,9 @@
event_loopexit(NULL);
break;
case SIGCHLD:
- if (waitpid(pop3e_pid, &status, WNOHANG) > 0)
- if (WIFEXITED(status) || WIFSIGNALED(status)) {
+ if (waitpid(WAIT_ANY, &status, WNOHANG) > 0)
+ if ((WIFEXITED(status) && WEXITSTATUS(status) != 0) ||
+ WIFSIGNALED(status)) {
logit(LOG_ERR, "Lost pop3 engine");
event_loopexit(NULL);
}