Merge pull request #3 from jturner/killzombies
authorSunil Nimmagadda <sunil@poolp.org>
Thu, 10 Apr 2014 18:13:08 +0500
changeset 13 0398655156a3
parent 10 d1fb040b60d9 (current diff)
parent 11 12ebfb79038d (diff)
child 15 a32f6ca3e290
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);
 			}