From 76345508b0a0d4acc78363e869f706172750d120 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Sun, 17 Jan 2016 16:55:25 +0000 Subject: make_nonblocking_noninheritable(): fixed checking for current non-blocking flags, improved error report. --- src/microhttpd/daemon.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/microhttpd') diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 7f0a1cdf..ef002eea 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c @@ -1878,12 +1878,13 @@ make_nonblocking_noninheritable (struct MHD_Daemon *daemon, #endif flags = fcntl (sock, F_GETFD); if ( ( (-1 == flags) || - ( (flags != (flags | FD_CLOEXEC)) && + ( (flags != (flags | nonblock | FD_CLOEXEC)) && (0 != fcntl (sock, F_SETFD, flags | nonblock | FD_CLOEXEC)) ) ) ) { #ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Failed to make socket non-inheritable: %s\n", + "Failed to make socket %snon-inheritable: %s\n", + ((nonblock) ? "non-blocking " : ""), MHD_socket_last_strerr_ ()); #endif } -- cgit v1.2.3