From: Bernhard Tittelbach Date: Fri, 18 Jun 2010 20:42:43 +0000 (+0000) Subject: ignore SIGPIPE and thus don't crash anymore X-Git-Url: https://git.realraum.at/?p=svn42.git;a=commitdiff_plain;h=56d5ad59ef70180139a39d661905b13b39e705d4 ignore SIGPIPE and thus don't crash anymore --- diff --git a/powersensordaemon/sig_handler.c b/powersensordaemon/sig_handler.c index ca2e18f..03cc99f 100644 --- a/powersensordaemon/sig_handler.c +++ b/powersensordaemon/sig_handler.c @@ -92,7 +92,8 @@ int signal_init() (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) || + (signal(SIGPIPE, SIG_IGN) == SIG_ERR)) { log_printf(ERROR, "signal handling init failed (sigaction error: %s)", strerror(errno)); close(sig_pipe_fds[0]); @@ -153,6 +154,7 @@ void signal_stop() sigaction(SIGHUP, &act, NULL); sigaction(SIGUSR1, &act, NULL); sigaction(SIGUSR2, &act, NULL); + signal(SIGPIPE, SIG_DFL); close(sig_pipe_fds[0]); close(sig_pipe_fds[1]);