summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2010-10-04 21:41:18 +0000
committerpjd <pjd@FreeBSD.org>2010-10-04 21:41:18 +0000
commit0651a7ac68496a46c14397f853730a149dd8809c (patch)
tree747ba731066fa628864d4e25a0a692b9b4a758cf /sbin
parent980d0e9a17f44ddce2dc201516adc672b2349b14 (diff)
downloadFreeBSD-src-0651a7ac68496a46c14397f853730a149dd8809c.zip
FreeBSD-src-0651a7ac68496a46c14397f853730a149dd8809c.tar.gz
We can't mask ignored signal, so install dummy signal hander for SIGCHLD before
masking it. This fixes bogus reports about hooks running for too long and other problems related to garbage-collecting child processes. Reported by: Mikolaj Golub <to.my.trociny@gmail.com> MFC after: 3 days
Diffstat (limited to 'sbin')
-rw-r--r--sbin/hastd/hastd.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sbin/hastd/hastd.c b/sbin/hastd/hastd.c
index e47b19d..8b59c14 100644
--- a/sbin/hastd/hastd.c
+++ b/sbin/hastd/hastd.c
@@ -685,6 +685,12 @@ main_loop(void)
}
}
+static void
+dummy_sighandler(int sig __unused)
+{
+ /* Nothing to do. */
+}
+
int
main(int argc, char *argv[])
{
@@ -743,6 +749,11 @@ main(int argc, char *argv[])
cfg = yy_config_parse(cfgpath, true);
assert(cfg != NULL);
+ /*
+ * Because SIGCHLD is ignored by default, setup dummy handler for it,
+ * so we can mask it.
+ */
+ PJDLOG_VERIFY(signal(SIGCHLD, dummy_sighandler) != SIG_ERR);
PJDLOG_VERIFY(sigemptyset(&mask) == 0);
PJDLOG_VERIFY(sigaddset(&mask, SIGHUP) == 0);
PJDLOG_VERIFY(sigaddset(&mask, SIGINT) == 0);
OpenPOWER on IntegriCloud