Browse Source

[core] clear FDEVENT_RDHUP if no POLLRDHUP

(fix for poll() on FreeBSD 11)
personal/stbuehler/ci-build
Glenn Strauss 3 years ago
parent
commit
b135b4d24d
  1. 3
      src/fdevent_linux_sysepoll.c
  2. 4
      src/fdevent_poll.c

3
src/fdevent_linux_sysepoll.c

@ -26,6 +26,9 @@ static int fdevent_linux_sysepoll_event_set(fdevents *ev, fdnode *fdn, int event
int op = (-1 == fdn->fde_ndx) ? EPOLL_CTL_ADD : EPOLL_CTL_MOD;
int fd = fdn->fde_ndx = fdn->fd;
struct epoll_event ep;
#ifndef EPOLLRDHUP
events &= ~FDEVENT_RDHUP;
#endif
ep.events = events | EPOLLERR | EPOLLHUP;
ep.data.ptr = fdn;
return epoll_ctl(ev->epoll_fd, op, fd, &ep);

4
src/fdevent_poll.c

@ -47,6 +47,10 @@ static int fdevent_poll_event_set(fdevents *ev, fdnode *fdn, int events) {
int fd = fdn->fd;
int k = fdn->fde_ndx;
#ifndef POLLRDHUP
events &= ~FDEVENT_RDHUP;
#endif
if (k >= 0) {
if ((size_t)k >= ev->used || ev->pollfds[k].fd != fd) return (errno = EINVAL, -1);
ev->pollfds[k].events = events;

Loading…
Cancel
Save