summaryrefslogtreecommitdiffstats
path: root/usr.sbin/hotplugd
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2009-06-10 18:50:43 +0000
committerguenther <guenther@openbsd.org>2009-06-10 18:50:43 +0000
commitb9ddec1af26c90f6ee8808aa9490917b3bf581be (patch)
tree8a81a8fa124cbfa8c3311fbdacbaa3f771321e7f /usr.sbin/hotplugd
parentRemove (unused) CASSERT macro. Whatever it was intended to be used for, it (diff)
downloadwireguard-openbsd-b9ddec1af26c90f6ee8808aa9490917b3bf581be.tar.xz
wireguard-openbsd-b9ddec1af26c90f6ee8808aa9490917b3bf581be.zip
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");
}