Make sure zombie processes are left over
authorJames Turner <james@calminferno.net>
Wed, 09 Apr 2014 21:36:45 -0400
changeset 11 12ebfb79038d
parent 10 d1fb040b60d9
child 13 0398655156a3
child 14 1f2f363d10cc
Make sure zombie processes are left over
pop3d.c
--- a/pop3d.c	Mon Apr 07 12:28:10 2014 +0500
+++ b/pop3d.c	Wed Apr 09 21:36:45 2014 -0400
@@ -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);
 			}