summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2010-10-03 23:40:16 (GMT)
committerChristian Pointner <equinox@helsinki.at>2010-10-03 23:40:16 (GMT)
commitac57681086acc8d879e6c0d2c01bc85b0b42bbd8 (patch)
treeb4276f3e0b56562024d319f9b850989e6e690333
parentf0b5dbbe8b6379c40620af13719a0fc2ee565654 (diff)
ignoring SIG_CHLD and SIG_PIPE by default
-rw-r--r--sig_handler.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sig_handler.c b/sig_handler.c
index ca2e18f..efb6ee6 100644
--- a/sig_handler.c
+++ b/sig_handler.c
@@ -82,17 +82,22 @@ int signal_init()
}
}
- struct sigaction act;
+ struct sigaction act, ign;
act.sa_handler = sig_handler;
sigfillset(&act.sa_mask);
act.sa_flags = 0;
+ ign.sa_handler = SIG_IGN;
+ sigfillset(&ign.sa_mask);
+ ign.sa_flags = 0;
if((sigaction(SIGINT, &act, NULL) < 0) ||
(sigaction(SIGQUIT, &act, NULL) < 0) ||
(sigaction(SIGTERM, &act, NULL) < 0) ||
(sigaction(SIGHUP, &act, NULL) < 0) ||
(sigaction(SIGUSR1, &act, NULL) < 0) ||
- (sigaction(SIGUSR2, &act, NULL) < 0)) {
+ (sigaction(SIGUSR2, &act, NULL) < 0) ||
+ (sigaction(SIGCHLD, &ign, NULL) < 0) ||
+ (sigaction(SIGPIPE, &ign, NULL) < 0)) {
log_printf(ERROR, "signal handling init failed (sigaction error: %s)", strerror(errno));
close(sig_pipe_fds[0]);
@@ -153,6 +158,8 @@ void signal_stop()
sigaction(SIGHUP, &act, NULL);
sigaction(SIGUSR1, &act, NULL);
sigaction(SIGUSR2, &act, NULL);
+ sigaction(SIGCHLD, &act, NULL);
+ sigaction(SIGPIPE, &act, NULL);
close(sig_pipe_fds[0]);
close(sig_pipe_fds[1]);