summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authormurray <murray@FreeBSD.org>2001-09-06 09:53:53 +0000
committermurray <murray@FreeBSD.org>2001-09-06 09:53:53 +0000
commit0f03af28848984fbf119d9f237214829511e5d5a (patch)
tree5459d31b5baa5c83343f1291fc1827bac94f8d9a /usr.sbin
parentd2f14e461c5cffbdeeb5c7551c3ce498d4303b51 (diff)
downloadFreeBSD-src-0f03af28848984fbf119d9f237214829511e5d5a.zip
FreeBSD-src-0f03af28848984fbf119d9f237214829511e5d5a.tar.gz
If we're running as init, install a signal handler for SIGCHLD.
PR: bin/14729 Submitted by: jhb
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sade/system.c13
-rw-r--r--usr.sbin/sysinstall/system.c13
2 files changed, 26 insertions, 0 deletions
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
index dbf0dc5..dc3e833 100644
--- a/usr.sbin/sade/system.c
+++ b/usr.sbin/sade/system.c
@@ -85,6 +85,18 @@ handle_intr(int sig)
restorescr(save);
}
+/*
+ * Harvest children if we are init.
+ */
+static void
+reap_children(int sig)
+{
+ int errbak = errno;
+ while ( waitpid(-1, NULL, WNOHANG) > 0 )
+ ;
+ errno = errbak;
+}
+
/* Expand a file into a convenient location, nuking it each time */
static char *
expand(char *fname)
@@ -166,6 +178,7 @@ systemInitialize(int argc, char **argv)
i = 0;
sysctlbyname("machdep.unaligned_print", NULL, 0, &i, sizeof(i));
#endif
+ signal(SIGCHLD, reap_children);
}
else {
char hname[256];
diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c
index dbf0dc5..dc3e833 100644
--- a/usr.sbin/sysinstall/system.c
+++ b/usr.sbin/sysinstall/system.c
@@ -85,6 +85,18 @@ handle_intr(int sig)
restorescr(save);
}
+/*
+ * Harvest children if we are init.
+ */
+static void
+reap_children(int sig)
+{
+ int errbak = errno;
+ while ( waitpid(-1, NULL, WNOHANG) > 0 )
+ ;
+ errno = errbak;
+}
+
/* Expand a file into a convenient location, nuking it each time */
static char *
expand(char *fname)
@@ -166,6 +178,7 @@ systemInitialize(int argc, char **argv)
i = 0;
sysctlbyname("machdep.unaligned_print", NULL, 0, &i, sizeof(i));
#endif
+ signal(SIGCHLD, reap_children);
}
else {
char hname[256];
OpenPOWER on IntegriCloud