summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2010-10-03 23:08:23 +0000
committerChristian Pointner <equinox@anytun.org>2010-10-03 23:08:23 +0000
commitdaa64cc5cfb32dae23adecb9edb11867c99a0e4e (patch)
tree9a3f46abef7821ca275b6fa61f189a6f97ac56f7
parentfixed configure (no svn error output) (diff)
blocking SIG_PIPE and SIG_CHLD by default
-rw-r--r--src/sig_handler.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sig_handler.c b/src/sig_handler.c
index bed72ba..dd5cff3 100644
--- a/src/sig_handler.c
+++ b/src/sig_handler.c
@@ -79,17 +79,22 @@ int signal_init()
}
}
- struct sigaction act;
+ struct sigaction act, act_ign;
act.sa_handler = sig_handler;
sigfillset(&act.sa_mask);
act.sa_flags = 0;
+ act_ign.sa_handler = SIG_IGN;
+ sigfillset(&act_ign.sa_mask);
+ act_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, &act_ign, NULL) < 0) ||
+ (sigaction(SIGPIPE, &act_ign, NULL) < 0)) {
log_printf(ERROR, "signal handling init failed (sigaction error: %s)", strerror(errno));
close(sig_pipe_fds[0]);
@@ -150,6 +155,8 @@ void signal_stop()
sigaction(SIGHUP, &act, NULL);
sigaction(SIGUSR1, &act, NULL);
sigaction(SIGUSR2, &act, NULL);
+ sigaction(SIGPIPE, &act, NULL);
+ sigaction(SIGCHLD, &act, NULL);
close(sig_pipe_fds[0]);
close(sig_pipe_fds[1]);