aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r--src/microhttpd/daemon.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 314dabca..dbe0cb58 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3333,7 +3333,11 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
3333{ 3333{
3334 struct epoll_event event; 3334 struct epoll_event event;
3335 3335
3336#ifdef HAVE_EPOLL_CREATE1
3336 daemon->epoll_fd = epoll_create1 (EPOLL_CLOEXEC); 3337 daemon->epoll_fd = epoll_create1 (EPOLL_CLOEXEC);
3338#else /* !HAVE_EPOLL_CREATE1 */
3339 daemon->epoll_fd = epoll_create (MAX_EVENTS);
3340#endif /* !HAVE_EPOLL_CREATE1 */
3337 if (-1 == daemon->epoll_fd) 3341 if (-1 == daemon->epoll_fd)
3338 { 3342 {
3339#if HAVE_MESSAGES 3343#if HAVE_MESSAGES
@@ -3343,6 +3347,20 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
3343#endif 3347#endif
3344 return MHD_NO; 3348 return MHD_NO;
3345 } 3349 }
3350#ifndef HAVE_EPOLL_CREATE1
3351 else
3352 {
3353 int fdflags = fcntl (daemon->epoll_fd, F_GETFD);
3354 if (0 > fdflags || 0 > fcntl (daemon->epoll_fd, F_SETFD, fdflags | FD_CLOEXEC))
3355 {
3356#if HAVE_MESSAGES
3357 MHD_DLOG (daemon,
3358 "Failed to change flags on epoll fd: %s\n",
3359 MHD_socket_last_strerr_ ());
3360#endif /* HAVE_MESSAGES */
3361 }
3362 }
3363#endif /* !HAVE_EPOLL_CREATE1 */
3346 if (0 == EPOLL_CLOEXEC) 3364 if (0 == EPOLL_CLOEXEC)
3347 make_nonblocking_noninheritable (daemon, 3365 make_nonblocking_noninheritable (daemon,
3348 daemon->epoll_fd); 3366 daemon->epoll_fd);