summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pop3d.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pop3d.c b/pop3d.c
index 77cbfa0..73656a8 100644
--- a/pop3d.c
+++ b/pop3d.c
@@ -203,8 +203,9 @@ sig_handler(int sig, short event, void *arg)
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);
}