svn commit: r236970 - stable/9/usr.sbin/daemon
Mikolaj Golub
trociny at FreeBSD.org
Tue Jun 12 20:04:24 UTC 2012
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);
}
More information about the svn-src-stable-9
mailing list