poll() revents bits are reset by poll()
This commit is contained in:
parent
c8eb238f31
commit
eb463ab086
@ -349,15 +349,12 @@ static void do_ifch_work(void)
|
|||||||
if (errno != EINTR) suicide("poll failed");
|
if (errno != EINTR) suicide("poll failed");
|
||||||
}
|
}
|
||||||
if (pfds[0].revents & POLLIN) {
|
if (pfds[0].revents & POLLIN) {
|
||||||
pfds[0].revents &= ~POLLIN;
|
|
||||||
process_client_socket();
|
process_client_socket();
|
||||||
}
|
}
|
||||||
if (pfds[0].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
if (pfds[0].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
||||||
pfds[0].revents &= ~(POLLHUP|POLLERR|POLLRDHUP);
|
|
||||||
suicide("ifchSock closed unexpectedly");
|
suicide("ifchSock closed unexpectedly");
|
||||||
}
|
}
|
||||||
if (pfds[1].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
if (pfds[1].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
||||||
pfds[1].revents &= ~(POLLHUP|POLLERR|POLLRDHUP);
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
src/ndhc.c
12
src/ndhc.c
@ -309,44 +309,35 @@ static void do_ndhc_work(void)
|
|||||||
int sev_rfk = RFK_NONE;
|
int sev_rfk = RFK_NONE;
|
||||||
bool force_fingerprint = false;
|
bool force_fingerprint = false;
|
||||||
if (pfds[0].revents & POLLIN) {
|
if (pfds[0].revents & POLLIN) {
|
||||||
pfds[0].revents &= ~POLLIN;
|
|
||||||
had_event = true;
|
had_event = true;
|
||||||
sev_nl = nl_event_get(&cs);
|
sev_nl = nl_event_get(&cs);
|
||||||
}
|
}
|
||||||
if (pfds[0].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
if (pfds[0].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
||||||
pfds[0].revents &= ~(POLLHUP|POLLERR|POLLRDHUP);
|
|
||||||
suicide("nlfd closed unexpectedly");
|
suicide("nlfd closed unexpectedly");
|
||||||
}
|
}
|
||||||
if (pfds[1].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
if (pfds[1].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
||||||
pfds[1].revents &= ~(POLLHUP|POLLERR|POLLRDHUP);
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (pfds[2].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
if (pfds[2].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
||||||
pfds[2].revents &= ~(POLLHUP|POLLERR|POLLRDHUP);
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (pfds[3].revents & POLLIN) {
|
if (pfds[3].revents & POLLIN) {
|
||||||
pfds[3].revents &= ~POLLIN;
|
|
||||||
had_event = true;
|
had_event = true;
|
||||||
sev_rfk = rfkill_get(&cs, 1, client_config.rfkillIdx);
|
sev_rfk = rfkill_get(&cs, 1, client_config.rfkillIdx);
|
||||||
}
|
}
|
||||||
if (pfds[3].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
if (pfds[3].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
||||||
pfds[3].revents &= ~(POLLHUP|POLLERR|POLLRDHUP);
|
|
||||||
suicide("rfkillfd closed unexpectedly");
|
suicide("rfkillfd closed unexpectedly");
|
||||||
}
|
}
|
||||||
if (pfds[4].revents & POLLIN) {
|
if (pfds[4].revents & POLLIN) {
|
||||||
pfds[4].revents &= ~POLLIN;
|
|
||||||
had_event = true;
|
had_event = true;
|
||||||
// Make sure the fd is still the same.
|
// Make sure the fd is still the same.
|
||||||
if (pfds[4].fd == cs.arpFd)
|
if (pfds[4].fd == cs.arpFd)
|
||||||
sev_arp = arp_packet_get(&cs);
|
sev_arp = arp_packet_get(&cs);
|
||||||
}
|
}
|
||||||
if (pfds[4].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
if (pfds[4].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
||||||
pfds[4].revents &= ~(POLLHUP|POLLERR|POLLRDHUP);
|
|
||||||
suicide("arpfd closed unexpectedly");
|
suicide("arpfd closed unexpectedly");
|
||||||
}
|
}
|
||||||
if (pfds[5].revents & POLLIN) {
|
if (pfds[5].revents & POLLIN) {
|
||||||
pfds[5].revents &= ~POLLIN;
|
|
||||||
had_event = true;
|
had_event = true;
|
||||||
// Make sure the fd is still the same.
|
// Make sure the fd is still the same.
|
||||||
if (pfds[5].fd == cs.listenFd)
|
if (pfds[5].fd == cs.listenFd)
|
||||||
@ -354,7 +345,6 @@ static void do_ndhc_work(void)
|
|||||||
&dhcp_srcaddr);
|
&dhcp_srcaddr);
|
||||||
}
|
}
|
||||||
if (pfds[5].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
if (pfds[5].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
||||||
pfds[5].revents &= ~(POLLHUP|POLLERR|POLLRDHUP);
|
|
||||||
suicide("listenfd closed unexpectedly");
|
suicide("listenfd closed unexpectedly");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,7 +516,6 @@ static void wait_for_rfkill()
|
|||||||
if (errno != EINTR) suicide("poll failed");
|
if (errno != EINTR) suicide("poll failed");
|
||||||
}
|
}
|
||||||
if (pfds[0].revents & POLLIN) {
|
if (pfds[0].revents & POLLIN) {
|
||||||
pfds[0].revents &= ~POLLIN;
|
|
||||||
if (rfkill_get(&cs, 0, 0) == RFK_DISABLED) {
|
if (rfkill_get(&cs, 0, 0) == RFK_DISABLED) {
|
||||||
switch (perform_ifup()) {
|
switch (perform_ifup()) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -539,7 +528,6 @@ static void wait_for_rfkill()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pfds[0].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
if (pfds[0].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
||||||
pfds[0].revents &= ~(POLLHUP|POLLERR|POLLRDHUP);
|
|
||||||
suicide("rfkillFd closed unexpectedly");
|
suicide("rfkillFd closed unexpectedly");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -557,15 +557,12 @@ static void do_sockd_work(void)
|
|||||||
if (errno != EINTR) suicide("poll failed");
|
if (errno != EINTR) suicide("poll failed");
|
||||||
}
|
}
|
||||||
if (pfds[0].revents & POLLIN) {
|
if (pfds[0].revents & POLLIN) {
|
||||||
pfds[0].revents &= ~POLLIN;
|
|
||||||
process_client_socket();
|
process_client_socket();
|
||||||
}
|
}
|
||||||
if (pfds[0].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
if (pfds[0].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
||||||
pfds[0].revents &= ~(POLLHUP|POLLERR|POLLRDHUP);
|
|
||||||
suicide("sockdSock closed unexpectedly");
|
suicide("sockdSock closed unexpectedly");
|
||||||
}
|
}
|
||||||
if (pfds[1].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
if (pfds[1].revents & (POLLHUP|POLLERR|POLLRDHUP)) {
|
||||||
pfds[1].revents &= ~(POLLHUP|POLLERR|POLLRDHUP);
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user