summaryrefslogtreecommitdiffstats
path: root/email.c
diff options
context:
space:
mode:
Diffstat (limited to 'email.c')
-rw-r--r--email.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/email.c b/email.c
index 31c22b8..0ee47ff 100644
--- a/email.c
+++ b/email.c
@@ -5,6 +5,8 @@
#include <syslog.h>
#include <fcntl.h>
#include <unistd.h>
+#include <sys/wait.h>
+
#include "email.h"
@@ -12,6 +14,9 @@
static int daemonish (int nochdir, int noclose)
{
+ pid_t pid;
+ int status;
+
if (!nochdir && chdir ("/"))
return -1;
@@ -28,7 +33,7 @@ static int daemonish (int nochdir, int noclose)
if (failed) return -1;
}
- switch (fork()) {
+ switch ((pid = fork())) {
case 0:
break;
@@ -36,6 +41,7 @@ static int daemonish (int nochdir, int noclose)
return -1;
default:
+ waitpid (pid, &status, 0);
return 1;;
}