summaryrefslogtreecommitdiff
path: root/sig_handler.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2010-10-03 21:38:50 (GMT)
committerChristian Pointner <equinox@helsinki.at>2010-10-03 21:38:50 (GMT)
commit08a6ab5dd6874dcf250c531a94b9fbdd14ecee92 (patch)
tree2f99b29c547cabcbc89f0503c0d2c8aaa8eadec0 /sig_handler.c
parent1f6363f31ae1cd54f3fbe7717f0bb51df4bc6e25 (diff)
fixed signal handler (block SIGPIPE)
Diffstat (limited to 'sig_handler.c')
-rw-r--r--sig_handler.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sig_handler.c b/sig_handler.c
index 1a88ddb..d9f78b1 100644
--- a/sig_handler.c
+++ b/sig_handler.c
@@ -82,17 +82,21 @@ int signal_init()
}
}
- struct sigaction act;
+ struct sigaction act, agt_ign;
act.sa_handler = sig_handler;
sigfillset(&act.sa_mask);
act.sa_flags = 0;
+ act_ign.sa_handler = sig_handler;
+ 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(SIGPIPE, &act_ign, NULL) < 0)) {
log_printf(ERROR, "signal handling init failed (sigaction error: %s)", strerror(errno));
close(sig_pipe_fds[0]);
@@ -153,6 +157,7 @@ void signal_stop()
sigaction(SIGHUP, &act, NULL);
sigaction(SIGUSR1, &act, NULL);
sigaction(SIGUSR2, &act, NULL);
+ sigaction(SIGPIPE, &act, NULL);
close(sig_pipe_fds[0]);
close(sig_pipe_fds[1]);