diff options
author | trociny <trociny@FreeBSD.org> | 2012-06-04 09:22:22 +0000 |
---|---|---|
committer | trociny <trociny@FreeBSD.org> | 2012-06-04 09:22:22 +0000 |
commit | 1300b8151a020d9fe459a88b4d4ee9c6f46e95cb (patch) | |
tree | c33aaac6101db3b9a8db7e458dad9509b34cb46b /usr.sbin | |
parent | d15be0fc1fd5bce459aac4cb24ad19643532c062 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | usr.sbin/daemon/daemon.c | 4 |
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; |