summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-01-01 15:39:32 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2020-01-26 00:41:05 -0500
commitfce489b806d82b7c8d59a44e7e394c4aeba8448a (patch)
treefef0ccbf4a1c98d1f819a81d190d6969f1205b5c
parent9cdfb4846653253f2c11dd74964eb4a9bc006a2c (diff)
downloadlighttpd-1.x-fce489b806d82b7c8d59a44e7e394c4aeba8448a.tar.gz
lighttpd-1.x-fce489b806d82b7c8d59a44e7e394c4aeba8448a.zip
[core] fall back to accept() if accept4() EPERM (fixes #2998)
On some architectures, accept4() might result in EPERM depending on Linux kernel and/or glibc support for accept4() (thx alex-che) x-ref: "accept4 returns EPERM instead of ENOSYS on some platforms" https://redmine.lighttpd.net/issues/2998
-rw-r--r--src/fdevent.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/fdevent.c b/src/fdevent.c
index 3a038c02..b6cc7d88 100644
--- a/src/fdevent.c
+++ b/src/fdevent.c
@@ -637,9 +637,18 @@ int fdevent_accept_listenfd(int listenfd, struct sockaddr *addr, size_t *addrlen
fd = -1;
}
}
- } else if (errno == ENOSYS || errno == ENOTSUP) {
- fd = accept(listenfd, addr, &len);
- sock_cloexec = 0;
+ }
+ else {
+ switch (errno) {
+ case ENOSYS:
+ case ENOTSUP:
+ case EPERM:
+ fd = accept(listenfd, addr, &len);
+ sock_cloexec = 0;
+ break;
+ default:
+ break;
+ }
}
}
else {