Skip to content

Commit

Permalink
Fixed module_deregister_fd test on osx.
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeDP committed Nov 2, 2018
1 parent fd5070d commit 9c8c02d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Lib/poll_plugins/kqueue_priv.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ int poll_set_new_evt(module_poll_t *tmp, m_context *c, enum op_type flag) {
struct kevent *_ev = (struct kevent *)tmp->ev;
EV_SET(_ev, tmp->fd, EVFILT_READ, f, 0, 0, (void *)tmp);
int ret = kevent(c->fd, _ev, 1, NULL, 0, NULL);
/* Workaround for STDIN_FILENO: it returns EINVAL but it is actually pollable */
if (ret == -1 && tmp->fd == STDIN_FILENO && errno == EINVAL) {
ret = 0;
/* Workaround for STDIN_FILENO: it returns EINVAL on add, and ENOENT on remove but it is actually pollable */
if (ret == -1 && tmp->fd == STDIN_FILENO) {
if ((f == EV_ADD && errno == EINVAL) || (f == EV_DELETE && errno == ENOENT)) {
ret = 0;
}
}
return ret;
}
Expand Down

0 comments on commit 9c8c02d

Please sign in to comment.