svn commit: r236550 - head/usr.sbin/daemon

Mikolaj Golub trociny at FreeBSD.org
Mon Jun 4 09:22:23 UTC 2012


Author: trociny
Date: Mon Jun  4 09:22:22 2012
New Revision: 236550
URL: http://svn.freebsd.org/changeset/base/236550

Log:
  On a child exit, call waitpid(2) to clean up the process table.
  
  Submitted by:	Andrey Zonov <andrey zonov.org>
  MFC after:	1 week

Modified:
  head/usr.sbin/daemon/daemon.c

Modified: head/usr.sbin/daemon/daemon.c
==============================================================================
--- head/usr.sbin/daemon/daemon.c	Mon Jun  4 08:40:14 2012	(r236549)
+++ head/usr.sbin/daemon/daemon.c	Mon Jun  4 09:22:22 2012	(r236550)
@@ -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;


More information about the svn-src-all mailing list