summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2019-02-16 10:52:49 +0100
committerStefan Bühler <stbuehler@web.de>2019-02-16 10:52:49 +0100
commit1bd1d559b512876b8dca5dafa4d328cc6a837a37 (patch)
tree3b54d63b6807fda9a8e4df3ebc31d4dd1a37a86d
parentf5f221eda837cecb3a52c297ac0ff36665e165e2 (diff)
downloadlighttpd1.4-1bd1d559b512876b8dca5dafa4d328cc6a837a37.tar.gz
lighttpd1.4-1bd1d559b512876b8dca5dafa4d328cc6a837a37.zip
[core] don't call fd event handlers more than once, they might already be gone (fixes segfault)
-rw-r--r--src/fdevent_poll.c2
-rw-r--r--src/fdevent_select.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/fdevent_poll.c b/src/fdevent_poll.c
index d88cd743..ea52d84e 100644
--- a/src/fdevent_poll.c
+++ b/src/fdevent_poll.c
@@ -164,7 +164,7 @@ static int fdevent_poll_poll(fdevents *ev, int timeout_ms) {
for (int ndx = -1, i = 0; i < n; ++i) {
fdnode *fdn;
ndx = fdevent_poll_event_next_fdndx(ev, ndx);
- if (-1 == ndx) continue;
+ if (-1 == ndx) break;
fdn = ev->fdarray[ndx];
if (0 == ((uintptr_t)fdn & 0x3)) {
int revents = fdevent_poll_event_get_revent(ev, i);
diff --git a/src/fdevent_select.c b/src/fdevent_select.c
index eef08d57..fe58ff8e 100644
--- a/src/fdevent_select.c
+++ b/src/fdevent_select.c
@@ -102,7 +102,7 @@ static int fdevent_select_poll(fdevents *ev, int timeout_ms) {
for (int ndx = -1, i = 0; i < n; ++i) {
fdnode *fdn;
ndx = fdevent_select_event_next_fdndx(ev, ndx);
- if (-1 == ndx) continue;
+ if (-1 == ndx) break;
fdn = ev->fdarray[ndx];
if (0 == ((uintptr_t)fdn & 0x3)) {
int revents = fdevent_select_event_get_revent(ev, ndx);