Catch EBADF in async

This commit is contained in:
lorenz.stechauner committed 2023-01-05 22:04:18 +01:00
1 parent 4782707049
commit c7be0adc66
1 file changed
+5
+5
View File
@@ -256,9 +256,14 @@ void async_thread(void) {
evt_listen_t *evt = events[i].data.ptr; evt_listen_t *evt = events[i].data.ptr;
if (async_exec(evt, async_e2a(events[i].events)) == 0) { if (async_exec(evt, async_e2a(events[i].events)) == 0) {
if (epoll_ctl(epoll_fd, EPOLL_CTL_DEL, evt->fd, NULL) == -1) { if (epoll_ctl(epoll_fd, EPOLL_CTL_DEL, evt->fd, NULL) == -1) {
if (errno == EBADF) {
// already closed fd, do not die
errno = 0;
} else {
critical("Unable to remove file descriptor from epoll instance"); critical("Unable to remove file descriptor from epoll instance");
return; return;
} }
}
local = list_delete(local, &evt); local = list_delete(local, &evt);
if (local == NULL) { if (local == NULL) {