Check and clear events from poll() even if interrupted by signal.

This commit is contained in:
Nicholas J. Kain 2020-11-06 18:32:38 -05:00
parent 1e60b4b8e7
commit a91b1d34ac
3 changed files with 4 additions and 8 deletions

View File

@ -349,8 +349,7 @@ static void do_ifch_work(void)
for (;;) {
if (poll(pfds, 2, -1) < 0) {
if (errno == EINTR) continue;
else suicide("pollt failed");
if (errno != EINTR) suicide("poll failed");
}
if (pfds[0].revents & POLLIN) {
pfds[0].revents &= ~POLLIN;

View File

@ -298,8 +298,7 @@ static void do_ndhc_work(void)
pfds[5].fd = cs.listenFd;
had_event = false;
if (poll(pfds, 6, timeout) < 0) {
if (errno != EINTR)
suicide("poll failed");
if (errno != EINTR) suicide("poll failed");
}
bool sev_dhcp = false;
@ -524,8 +523,7 @@ static void wait_for_rfkill()
for (;;) {
pfds[0].fd = cs.rfkillFd;
if (poll(pfds, 1, -1) < 0) {
if (errno == EINTR) continue;
else suicide("poll failed");
if (errno != EINTR) suicide("poll failed");
}
if (pfds[0].revents & POLLIN) {
pfds[0].revents &= ~POLLIN;

View File

@ -554,8 +554,7 @@ static void do_sockd_work(void)
for (;;) {
if (poll(pfds, 2, -1) < 0) {
if (errno == EINTR) continue;
else suicide("poll failed");
if (errno != EINTR) suicide("poll failed");
}
if (pfds[0].revents & POLLIN) {
pfds[0].revents &= ~POLLIN;