diff options
author | Christian Pointner <equinox@anylike.org> | 2010-10-03 21:53:40 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anylike.org> | 2010-10-03 21:53:40 +0000 |
commit | 567169ea7ccd500bd285d25d9e96dabb758a0bde (patch) | |
tree | 0b478eea2256daefcf62c950a8d94c83f4984636 | |
parent | small refactoring (diff) |
blocking SIGPIPE
-rw-r--r-- | src/sig_handler.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sig_handler.c b/src/sig_handler.c index 91a2f13..98ae50d 100644 --- a/src/sig_handler.c +++ b/src/sig_handler.c @@ -81,17 +81,21 @@ 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_DFL; + 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]); @@ -152,6 +156,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]); |