Minor signal handling fixes.

This commit is contained in:
Nicholas J. Kain 2020-10-21 09:49:22 -04:00
parent d58338b70b
commit b86735c478

View File

@ -177,7 +177,7 @@ static void signal_handler(int signo)
case SIGCHLD: { case SIGCHLD: {
static const char errstr[] = "ndhc-master: Subprocess terminated unexpectedly. Exiting.\n"; static const char errstr[] = "ndhc-master: Subprocess terminated unexpectedly. Exiting.\n";
safe_write(STDOUT_FILENO, errstr, sizeof errstr - 1); safe_write(STDOUT_FILENO, errstr, sizeof errstr - 1);
exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
} }
case SIGINT: case SIGINT:
case SIGTERM: l_signal_exit = 1; break; case SIGTERM: l_signal_exit = 1; break;
@ -298,8 +298,8 @@ static void do_ndhc_work(void)
pfds[5].fd = cs.listenFd; pfds[5].fd = cs.listenFd;
had_event = false; had_event = false;
if (poll(pfds, 6, timeout) < 0) { if (poll(pfds, 6, timeout) < 0) {
if (errno == EINTR) continue; if (errno != EINTR)
else suicide("poll failed"); suicide("poll failed");
} }
bool sev_dhcp = false; bool sev_dhcp = false;