diff --git a/epoll.c b/epoll.c index 299e3d355c..4b1e3963d1 100644 --- a/epoll.c +++ b/epoll.c @@ -487,7 +487,9 @@ epoll_dispatch(struct event_base *base, struct timeval *tv) continue; #endif - if (what & (EPOLLHUP|EPOLLERR)) { + if (what & EPOLLERR) { + ev = EV_READ | EV_WRITE; + } else if ((what & EPOLLHUP) && !(what & EPOLLRDHUP)) { ev = EV_READ | EV_WRITE; } else { if (what & EPOLLIN) diff --git a/test/regress.c b/test/regress.c index 53c0718319..fe2a8fd1e1 100644 --- a/test/regress.c +++ b/test/regress.c @@ -512,13 +512,8 @@ test_simpleclose(void *ptr) tt_assert(!event_base_loopexit(base, &tv)); } - /* via close() */ - if (pair[1] == -1) { - tt_int_op(event_base_loop(base, EVLOOP_NONBLOCK), ==, 0); - } else { - tt_int_op(event_base_loop(base, EVLOOP_NONBLOCK), ==, !persist); - tt_int_op(got_event, ==, (events & ~EV_PERSIST)); - } + tt_int_op(event_base_loop(base, EVLOOP_NONBLOCK), ==, !persist); + tt_int_op(got_event, ==, (events & ~EV_PERSIST)); end: if (ev)