Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jun 2012 20:04:24 +0000 (UTC)
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r236970 - stable/9/usr.sbin/daemon
Message-ID:  <201206122004.q5CK4OMs072977@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trociny
Date: Tue Jun 12 20:04:23 2012
New Revision: 236970
URL: http://svn.freebsd.org/changeset/base/236970

Log:
  MFC r236550, r236551:
  
  r236550:
  
  On a child exit, call waitpid(2) to clean up the process table.
  
  Submitted by:	Andrey Zonov <andrey zonov.org>
  
  r236551:
  
  Document -r option in SYNOPSIS and usage statement.
  
  Submitted by:	Andrey Zonov <andrey zonov.org>

Modified:
  stable/9/usr.sbin/daemon/daemon.8
  stable/9/usr.sbin/daemon/daemon.c
Directory Properties:
  stable/9/usr.sbin/daemon/   (props changed)

Modified: stable/9/usr.sbin/daemon/daemon.8
==============================================================================
--- stable/9/usr.sbin/daemon/daemon.8	Tue Jun 12 20:01:29 2012	(r236969)
+++ stable/9/usr.sbin/daemon/daemon.8	Tue Jun 12 20:04:23 2012	(r236970)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 19, 2012
+.Dd June 4, 2012
 .Dt DAEMON 8
 .Os
 .Sh NAME
@@ -34,7 +34,7 @@
 .Nd run detached from the controlling terminal
 .Sh SYNOPSIS
 .Nm
-.Op Fl cf
+.Op Fl cfr
 .Op Fl p Ar pidfile
 .Op Fl u Ar user
 .Ar command arguments ...

Modified: stable/9/usr.sbin/daemon/daemon.c
==============================================================================
--- stable/9/usr.sbin/daemon/daemon.c	Tue Jun 12 20:01:29 2012	(r236969)
+++ stable/9/usr.sbin/daemon/daemon.c	Tue Jun 12 20:04:23 2012	(r236970)
@@ -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;
@@ -236,7 +240,7 @@ static void
 usage(void)
 {
 	(void)fprintf(stderr,
-	    "usage: daemon [-cf] [-p pidfile] [-u user] command "
+	    "usage: daemon [-cfr] [-p pidfile] [-u user] command "
 		"arguments ...\n");
 	exit(1);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206122004.q5CK4OMs072977>