Handle SIGPIPE and SIGCHLD.
This commit is contained in:
parent
be456ddeee
commit
fac6794b6c
@ -285,7 +285,6 @@ static void setup_signals_ifch(void)
|
||||
{
|
||||
sigset_t mask;
|
||||
sigemptyset(&mask);
|
||||
// XXX: Do we need to change SIGPIPE?
|
||||
sigaddset(&mask, SIGPIPE);
|
||||
sigaddset(&mask, SIGUSR1);
|
||||
sigaddset(&mask, SIGUSR2);
|
||||
@ -323,7 +322,8 @@ static void signal_dispatch(void)
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
case SIGPIPE:
|
||||
// XXX: Handle SIGPIPE.
|
||||
log_line("ndhc-ifch: IPC pipe closed. Exiting.");
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -145,9 +145,18 @@ static void signal_dispatch(void)
|
||||
case SIGUSR2:
|
||||
force_release_action(&cs);
|
||||
break;
|
||||
case SIGPIPE:
|
||||
log_line("ndhc-master: IPC pipe closed. Exiting.");
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
case SIGCHLD:
|
||||
log_line("ndhc-master: Subprocess terminated unexpectedly. Exiting.");
|
||||
exit(EXIT_FAILURE);
|
||||
break;
|
||||
case SIGTERM:
|
||||
log_line("Received SIGTERM. Exiting gracefully.");
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -47,6 +47,8 @@ void setup_signals_ndhc(struct client_state_t *cs)
|
||||
sigemptyset(&mask);
|
||||
sigaddset(&mask, SIGUSR1);
|
||||
sigaddset(&mask, SIGUSR2);
|
||||
sigaddset(&mask, SIGCHLD);
|
||||
sigaddset(&mask, SIGPIPE);
|
||||
sigaddset(&mask, SIGTERM);
|
||||
if (sigprocmask(SIG_BLOCK, &mask, NULL) < 0)
|
||||
suicide("sigprocmask failed");
|
||||
|
Loading…
Reference in New Issue
Block a user