Allow proper behaviour when modifying events and deactivated

This commit is contained in:
Laurence Withers 2007-10-27 16:15:44 +00:00
parent f4b7935bb9
commit c7663cc4a2
1 changed files with 5 additions and 1 deletions

View File

@ -56,7 +56,11 @@ int lwevent_set_events(struct lwevent* ev, int events)
/* try the modification */
ee.events = events;
ee.data.ptr = ev;
if(TEMP_FAILURE_RETRY( epoll_ctl(lwevent_epoll_fd, EPOLL_CTL_MOD, ev->fd, &ee) )) return -1;
if(TEMP_FAILURE_RETRY( epoll_ctl(lwevent_epoll_fd, EPOLL_CTL_MOD, ev->fd, &ee) )) {
/* if we are deactivated, ENOENT will be returned, but we still want to store the events
* for later, so they will be used when reactivation occurs. */
if(errno != ENOENT) return -1;
}
/* update structure only if it succeeded */
ev->events = events;