diff --git a/ndhc/ifchd.c b/ndhc/ifchd.c index 9b39acb..a7a5c8e 100644 --- a/ndhc/ifchd.c +++ b/ndhc/ifchd.c @@ -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; diff --git a/ndhc/ndhc.c b/ndhc/ndhc.c index 7a8570a..6f5665b 100644 --- a/ndhc/ndhc.c +++ b/ndhc/ndhc.c @@ -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; } diff --git a/ndhc/sys.c b/ndhc/sys.c index 81cb369..abf7014 100644 --- a/ndhc/sys.c +++ b/ndhc/sys.c @@ -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");