Allow proper behaviour when modifying events and deactivated
This commit is contained in:
		
							parent
							
								
									f4b7935bb9
								
							
						
					
					
						commit
						c7663cc4a2
					
				| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue