LOG_DBG((LOG_MISC, 80, "%s: epoll_wait reports %d", __func__, res));
for (i = 0; i < res; i++) {
- int which = 0, what;
+ int which = 0;
+ int what = events[i].events;
struct event *evread = NULL, *evwrite = NULL;
evep = (struct evepoll *)events[i].data.ptr;
- what = events[i].events;
+
+ if (what & EPOLLHUP)
+ what |= EPOLLIN | EPOLLOUT;
+ else if (what & EPOLLERR)
+ what |= EPOLLIN | EPOLLOUT;
+
if (what & EPOLLIN) {
evread = evep->evread;
which |= EV_READ;
return (0);
for (i = 0; i < nfds; i++) {
+ int what = pop->event_set[i].revents;
+
res = 0;
+
/* If the file gets closed notify */
- if (pop->event_set[i].revents & POLLHUP)
- pop->event_set[i].revents = POLLIN|POLLOUT;
- if (pop->event_set[i].revents & POLLIN)
+ if (what & POLLHUP)
+ what |= POLLIN|POLLOUT;
+ if (what & POLLERR)
+ what |= POLLIN|POLLOUT;
+ if (what & POLLIN)
res |= EV_READ;
- if (pop->event_set[i].revents & POLLOUT)
+ if (what & POLLOUT)
res |= EV_WRITE;
if (res == 0)
continue;