summaryrefslogtreecommitdiffstats
path: root/usr.sbin/daemon/daemon.c
diff options
context:
space:
mode:
authortrociny <trociny@FreeBSD.org>2012-06-04 09:22:22 +0000
committertrociny <trociny@FreeBSD.org>2012-06-04 09:22:22 +0000
commit1300b8151a020d9fe459a88b4d4ee9c6f46e95cb (patch)
treec33aaac6101db3b9a8db7e458dad9509b34cb46b /usr.sbin/daemon/daemon.c
parentd15be0fc1fd5bce459aac4cb24ad19643532c062 (diff)
downloadFreeBSD-src-1300b8151a020d9fe459a88b4d4ee9c6f46e95cb.zip
FreeBSD-src-1300b8151a020d9fe459a88b4d4ee9c6f46e95cb.tar.gz
On a child exit, call waitpid(2) to clean up the process table.
Submitted by: Andrey Zonov <andrey zonov.org> MFC after: 1 week
Diffstat (limited to 'usr.sbin/daemon/daemon.c')
-rw-r--r--usr.sbin/daemon/daemon.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c
index 54d3123..cef2e08 100644
--- a/usr.sbin/daemon/daemon.c
+++ b/usr.sbin/daemon/daemon.c
@@ -217,6 +217,10 @@ wait_child(pid_t pid, sigset_t *mask)
}
switch (signo) {
case SIGCHLD:
+ if (waitpid(pid, NULL, WNOHANG) == -1) {
+ warn("waitpid");
+ return (-1);
+ }
return (terminate);
case SIGTERM:
terminate = 1;
OpenPOWER on IntegriCloud