pop3d.c
changeset 11 12ebfb79038d
parent 5 9e370734cb36
child 14 1f2f363d10cc
--- 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);
 			}