diff -r d1fb040b60d9 -r 12ebfb79038d 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); }