diff options
author | Hakan Olsson <ho@cvs.openbsd.org> | 2003-05-15 01:51:11 +0000 |
---|---|---|
committer | Hakan Olsson <ho@cvs.openbsd.org> | 2003-05-15 01:51:11 +0000 |
commit | eb23323264e3909068d9660840b9dab2ccf8e95e (patch) | |
tree | d786f679fe3192d53e1104461904e35b84dbefd6 /sbin | |
parent | be32c4b97a32e710ab0ef5e1beaf2bf3b9bae688 (diff) |
wait() for the child process
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/isakmpd/monitor.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sbin/isakmpd/monitor.c b/sbin/isakmpd/monitor.c index cac57a629ed..41a6d3fbd63 100644 --- a/sbin/isakmpd/monitor.c +++ b/sbin/isakmpd/monitor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.1 2003/05/15 00:28:53 ho Exp $ */ +/* $OpenBSD: monitor.c,v 1.2 2003/05/15 01:51:10 ho Exp $ */ /* * Copyright (c) 2003 Håkan Olsson. All rights reserved. @@ -31,6 +31,7 @@ #include <sys/socket.h> #include <sys/ioctl.h> #include <sys/stat.h> +#include <sys/wait.h> #include <errno.h> #include <fcntl.h> #include <pwd.h> @@ -90,7 +91,8 @@ monitor_init (void) m_state.s = p[m_state.pid ? 1 : 0]; strlcpy (m_state.root, pw->pw_dir, sizeof m_state.root); - LOG_DBG ((LOG_SYSDEP, 95, "monitor_init: pid %d my fd %d", m_state.pid, m_state.s)); + LOG_DBG ((LOG_SYSDEP, 95, "monitor_init: pid %d my fd %d", m_state.pid, + m_state.s)); /* The child process should drop privileges now. */ if (!m_state.pid) @@ -425,7 +427,11 @@ monitor_loop (int debugging) * is in the process of shutting down. */ if (sigtermed || sigchlded) - shutdown++; + { + if (sigchlded) + wait (&n); + shutdown++; + } FD_ZERO (fds); FD_SET (m_state.s, fds); |