[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
personal/stbuehler/ci-build
Glenn Strauss 2020-01-01 15:39:32 -05:00
parent 9cdfb48466
commit fce489b806
1 changed files with 12 additions and 3 deletions

View File

@ -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 {