summaryrefslogtreecommitdiff
path: root/usr.sbin/hotplugd
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2009-06-10 18:50:44 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2009-06-10 18:50:44 +0000
commit3db0d6c8b9c40479e8c2102f57684da0aecf0ddb (patch)
treed1d490e4cbe7e35430753200efd521e8006d5fe8 /usr.sbin/hotplugd
parente8f328d531ac3c6cce94de3c77dd3b98422f0a78 (diff)
Ignore ECHILD returns from waitpid() in the signal handler; it appears we
generate SIGCHLD spuriously in some cases. Also, hotplugd doesn't care if a child is stopped, so set SA_NOCLDSTOP to suppress SIGCHLDs from that. Problem reported by Thomas Pfaff. ok deraadt@
Diffstat (limited to 'usr.sbin/hotplugd')
-rw-r--r--usr.sbin/hotplugd/hotplugd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/hotplugd/hotplugd.c b/usr.sbin/hotplugd/hotplugd.c
index bd6c1627ee8..4142a6115f0 100644
--- a/usr.sbin/hotplugd/hotplugd.c
+++ b/usr.sbin/hotplugd/hotplugd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hotplugd.c,v 1.9 2008/05/25 16:49:04 jasper Exp $ */
+/* $OpenBSD: hotplugd.c,v 1.10 2009/06/10 18:50:43 guenther Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
*
@@ -90,6 +90,7 @@ main(int argc, char *argv[])
sact.sa_handler = SIG_IGN;
sigaction(SIGHUP, &sact, NULL);
sact.sa_handler = sigchild;
+ sact.sa_flags = SA_NOCLDSTOP;
sigaction(SIGCHLD, &sact, NULL);
openlog(_LOG_TAG, _LOG_OPT, _LOG_FACILITY);
@@ -185,7 +186,7 @@ sigchild(int signum)
syslog_r(LOG_NOTICE, &sdata,
"child is terminated abnormally");
}
- } else {
+ } else if (errno != ECHILD) {
syslog_r(LOG_ERR, &sdata, "waitpid: %m");
}