commit 76345508b0a0d4acc78363e869f706172750d120
parent 3a2ecf68e654e3612d32f8d7eb41c5bbadf7a563
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Sun, 17 Jan 2016 16:55:25 +0000
make_nonblocking_noninheritable(): fixed checking for current non-blocking flags,
improved error report.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git 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
}