summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-03-16 17:38:40 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2019-03-16 17:38:40 -0400
commitb135b4d24d53ac812ccda054fc75e4ef79b9a88b (patch)
tree624386b82ec57f02ccb28f1c69b134c94200b5e0
parentf2ac4cdfc5e8a37fc742dcd10c6608ac21281ba8 (diff)
downloadlighttpd1.4-b135b4d24d53ac812ccda054fc75e4ef79b9a88b.tar.gz
lighttpd1.4-b135b4d24d53ac812ccda054fc75e4ef79b9a88b.zip
[core] clear FDEVENT_RDHUP if no POLLRDHUP
(fix for poll() on FreeBSD 11)
-rw-r--r--src/fdevent_linux_sysepoll.c3
-rw-r--r--src/fdevent_poll.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/src/fdevent_linux_sysepoll.c b/src/fdevent_linux_sysepoll.c
index 66c2a04e..650e455d 100644
--- a/src/fdevent_linux_sysepoll.c
+++ b/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);
diff --git a/src/fdevent_poll.c b/src/fdevent_poll.c
index b1b34550..11636f2c 100644
--- a/src/fdevent_poll.c
+++ b/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;