From efdb33cd30c998bd8a75fc916b6efd5662e81b25 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 1 May 2012 15:38:01 +0000 Subject: [PATCH] fixed a glitch in a http sample --- qse/samples/net/http01.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/qse/samples/net/http01.c b/qse/samples/net/http01.c index b4e67069..5f1c63e4 100644 --- a/qse/samples/net/http01.c +++ b/qse/samples/net/http01.c @@ -574,7 +574,7 @@ static void* mux_open (qse_httpd_t* httpd) memset (mux, 0, QSE_SIZEOF(*mux)); -#if defined(HAVE_EPOLL_CREATE1) +#if defined(HAVE_EPOLL_CREATE1) && defined(O_CLOEXEC) mux->fd = epoll_create1 (O_CLOEXEC); #else mux->fd = epoll_create (100); @@ -586,11 +586,13 @@ static void* mux_open (qse_httpd_t* httpd) return QSE_NULL; } -#if defined(HAVE_EPOLL_CREATE1) +#if defined(HAVE_EPOLL_CREATE1) && defined(O_CLOEXEC) /* nothing else to do */ #else - flag = fcntl (mux->fd, F_GETFD); - if (flag >= 0) fcntl (mux->fd, F_SETFD, flag | FD_CLOEXEC); + { + int flag = fcntl (mux->fd, F_GETFD); + if (flag >= 0) fcntl (mux->fd, F_SETFD, flag | FD_CLOEXEC); + } #endif return mux;