From 1300b8151a020d9fe459a88b4d4ee9c6f46e95cb Mon Sep 17 00:00:00 2001 From: trociny Date: Mon, 4 Jun 2012 09:22:22 +0000 Subject: [PATCH] On a child exit, call waitpid(2) to clean up the process table. Submitted by: Andrey Zonov MFC after: 1 week --- usr.sbin/daemon/daemon.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 54d312358617..cef2e087333a 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;