svn commit: r213428 - head/sbin/hastd
Pawel Jakub Dawidek
pjd at FreeBSD.org
Mon Oct 4 21:41:19 UTC 2010
Author: pjd
Date: Mon Oct 4 21:41:18 2010
New Revision: 213428
URL: http://svn.freebsd.org/changeset/base/213428
Log:
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 at gmail.com>
MFC after: 3 days
Modified:
head/sbin/hastd/hastd.c
Modified: head/sbin/hastd/hastd.c
==============================================================================
--- head/sbin/hastd/hastd.c Mon Oct 4 21:38:10 2010 (r213427)
+++ head/sbin/hastd/hastd.c Mon Oct 4 21:41:18 2010 (r213428)
@@ -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);
More information about the svn-src-head
mailing list