X-Git-Url: https://git.realraum.at/?p=svn42.git;a=blobdiff_plain;f=powersensordaemon%2Fsig_handler.c;h=55fe5565a99a92b4fb8fb15f64308ff6f27c64b3;hp=03cc99f8e0dc6702362f49f1d8013d5ca025c760;hb=a34e51d757fe52cb19de2937ae1b211894167524;hpb=56d5ad59ef70180139a39d661905b13b39e705d4 diff --git a/powersensordaemon/sig_handler.c b/powersensordaemon/sig_handler.c index 03cc99f..55fe556 100644 --- a/powersensordaemon/sig_handler.c +++ b/powersensordaemon/sig_handler.c @@ -82,10 +82,13 @@ 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) || @@ -93,7 +96,8 @@ int signal_init() (sigaction(SIGHUP, &act, NULL) < 0) || (sigaction(SIGUSR1, &act, NULL) < 0) || (sigaction(SIGUSR2, &act, NULL) < 0) || - (signal(SIGPIPE, SIG_IGN) == SIG_ERR)) { + (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]); @@ -154,7 +158,8 @@ void signal_stop() sigaction(SIGHUP, &act, NULL); sigaction(SIGUSR1, &act, NULL); sigaction(SIGUSR2, &act, NULL); - signal(SIGPIPE, SIG_DFL); + sigaction(SIGPIPE, &act, NULL); + sigaction(SIGCHLD, &act, NULL); close(sig_pipe_fds[0]); close(sig_pipe_fds[1]);