X-Git-Url: https://git.llucax.com/software/libev.git/blobdiff_plain/f776d56f36abeed4a6091c2ec9b96363213ce2b2..22b2a449105d7604f715c1afafeb4fe5ac473f1b:/ev_epoll.c diff --git a/ev_epoll.c b/ev_epoll.c index 8bc8658..4689f8d 100644 --- a/ev_epoll.c +++ b/ev_epoll.c @@ -42,7 +42,10 @@ epoll_modify (EV_P_ int fd, int oev, int nev) (nev & EV_READ ? EPOLLIN : 0) | (nev & EV_WRITE ? EPOLLOUT : 0); - epoll_ctl (epoll_fd, mode, fd, &ev); + if (epoll_ctl (epoll_fd, mode, fd, &ev)) + if (errno != ENOENT /* on ENOENT the fd went away, so try to do the right thing */ + || (nev && epoll_ctl (epoll_fd, EPOLL_CTL_ADD, fd, &ev))) + fd_kill (EV_A_ fd); } static void