From b86ed94940f85b60f033c1f4a0c015a6d4de297c Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 17 Dec 2012 17:03:44 +0400 Subject: [PATCH] kqueue: ignore ENOENT error File descriptor might be closed during callback, all events that was reported before the callback are not valid and trying to remove them will result in ENOENT. This error can be safely ignored. --- src/unix/kqueue.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c index 73ee696e3..af9078e93 100644 --- a/src/unix/kqueue.c +++ b/src/unix/kqueue.c @@ -197,7 +197,9 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { /* TODO batch up */ struct kevent events[1]; EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0); - if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL)) abort(); + if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL)) + if (errno != ENOENT) + abort(); } } @@ -208,7 +210,9 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { /* TODO batch up */ struct kevent events[1]; EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0); - if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL)) abort(); + if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL)) + if (errno != ENOENT) + abort(); } }