summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@sunilnimmagadda.com>2014-04-10 18:25:43 +0500
committerSunil Nimmagadda <sunil@sunilnimmagadda.com>2014-04-10 18:25:43 +0500
commitb8ce860618b3c173fb0246a723778139983220db (patch)
tree5bade539bbeac4b37e786f4a0e9e5d45657c4a03
parent89c7cc9a5e434e25bfcbd06ea633a8b411f0e6de (diff)
parentcf7e82705fd6b2a1edfa0e24f998f2eb6357d950 (diff)
pull in latest master.
-rw-r--r--pop3d.c8
-rw-r--r--pop3d.h2
-rw-r--r--pop3e.c4
3 files changed, 7 insertions, 7 deletions
diff --git a/pop3d.c b/pop3d.c
index d047b42..02f293b 100644
--- a/pop3d.c
+++ b/pop3d.c
@@ -47,7 +47,6 @@ static enum m_type m_type(const char *);
static void usage(void);
static struct imsgev iev_pop3e;
-static pid_t pop3e_pid;
static const char *mpath;
static int mtype = M_MBOX;
@@ -102,7 +101,7 @@ main(int argc, char *argv[])
if ((pw = getpwnam(POP3D_USER)) == NULL)
fatalx("main: getpwnam " POP3D_USER);
- pop3e_pid = pop3_main(pair, pw);
+ pop3_main(pair, pw);
close(pair[1]);
setproctitle("[priv]");
logit(LOG_INFO, "pop3d ready; type:%s, path:%s", mtype_str, mpath);
@@ -206,8 +205,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);
}
diff --git a/pop3d.h b/pop3d.h
index 5697dbb..d2b29d0 100644
--- a/pop3d.h
+++ b/pop3d.h
@@ -144,7 +144,7 @@ struct session {
};
/* pop3e.c */
-pid_t pop3_main(int [2], struct passwd *);
+void pop3_main(int [2], struct passwd *);
/* session.c */
void session_init(struct listener *, int);
diff --git a/pop3e.c b/pop3e.c
index cb6f017..728df72 100644
--- a/pop3e.c
+++ b/pop3e.c
@@ -47,7 +47,7 @@ static void sig_handler(int, short, void *);
struct imsgev iev_pop3d;
void *ssl_ctx;
-pid_t
+void
pop3_main(int pair[2], struct passwd *pw)
{
extern struct session_tree sessions;
@@ -59,7 +59,7 @@ pop3_main(int pair[2], struct passwd *pw)
fatal("pop3e: fork");
if (pid > 0)
- return (pid);
+ return;
close(pair[0]);
setproctitle("pop3 engine");