summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-04-14 10:20:24 +0000
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-04-14 10:20:24 +0000
commit699c31e686ca3e1ecea93252d589f9a0e56c6a54 (patch)
treef2e3316835923f6a570b45146ae413304e69a285
parent71b73eca6ae6e2b9480e65ee50ee4ff51981fa89 (diff)
Don't create daemon if failed to make daemon control pipe non-blocking
-rw-r--r--src/microhttpd/daemon.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index bcbe6b50..fcbf445a 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3782,7 +3782,18 @@ MHD_start_daemon_va (unsigned int flags,
free (daemon);
return NULL;
}
- make_nonblocking (daemon, daemon->wpipe[0]);
+ if (MHD_NO == make_nonblocking (daemon, daemon->wpipe[0]))
+ {
+#ifdef HAVE_MESSAGES
+ MHD_DLOG (daemon,
+ "Failed to make control pipe non-blocking: %s\n",
+ MHD_strerror_ (errno));
+#endif
+ MHD_pipe_close_ (daemon->wpipe[0]);
+ MHD_pipe_close_ (daemon->wpipe[1]);
+ free (daemon);
+ return NULL;
+ }
make_nonblocking (daemon, daemon->wpipe[1]);
}
#ifndef MHD_WINSOCK_SOCKETS