summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/proxsmtpd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/proxsmtpd.c b/src/proxsmtpd.c
index 278ecee..8f50d96 100644
--- a/src/proxsmtpd.c
+++ b/src/proxsmtpd.c
@@ -925,6 +925,11 @@ static int wait_process(spctx_t* sp, pid_t pid, int* status)
switch(waitpid(pid, status, WNOHANG))
{
case 0:
+ /* Linux may return 0 if the task has already terminated and was
+ * caught by waitpid(-1) above, double check it still exists.
+ */
+ if (kill(pid, 0) < 0 && errno == ESRCH)
+ return 0;
break;
case -1:
if(errno != ECHILD && errno != ESRCH)