Skip to content

Commit 9c8c02d

Browse files
committed
Fixed module_deregister_fd test on osx.
1 parent fd5070d commit 9c8c02d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Lib/poll_plugins/kqueue_priv.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ int poll_set_new_evt(module_poll_t *tmp, m_context *c, enum op_type flag) {
2525
struct kevent *_ev = (struct kevent *)tmp->ev;
2626
EV_SET(_ev, tmp->fd, EVFILT_READ, f, 0, 0, (void *)tmp);
2727
int ret = kevent(c->fd, _ev, 1, NULL, 0, NULL);
28-
/* Workaround for STDIN_FILENO: it returns EINVAL but it is actually pollable */
29-
if (ret == -1 && tmp->fd == STDIN_FILENO && errno == EINVAL) {
30-
ret = 0;
28+
/* Workaround for STDIN_FILENO: it returns EINVAL on add, and ENOENT on remove but it is actually pollable */
29+
if (ret == -1 && tmp->fd == STDIN_FILENO) {
30+
if ((f == EV_ADD && errno == EINVAL) || (f == EV_DELETE && errno == ENOENT)) {
31+
ret = 0;
32+
}
3133
}
3234
return ret;
3335
}

0 commit comments

Comments
 (0)