aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/daemon.c
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-04-29 19:44:12 +0000
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-04-29 19:44:12 +0000
commit89d9493c84616eb423ab38248594f6d67cb867b5 (patch)
tree0fc439627977e53414f72120fd900077dc0d5582 /src/microhttpd/daemon.c
parente4d2c15c8dcb956c6e9bedd6e10b03ed979ae482 (diff)
downloadlibmicrohttpd-89d9493c84616eb423ab38248594f6d67cb867b5.tar.gz
libmicrohttpd-89d9493c84616eb423ab38248594f6d67cb867b5.zip
daemon.c: OS X: set SO_NOSIGPIPE on listen socket.
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r--src/microhttpd/daemon.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 091dff52..5476f956 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3598,6 +3598,9 @@ create_listen_socket (struct MHD_Daemon *daemon,
3598{ 3598{
3599 MHD_socket fd; 3599 MHD_socket fd;
3600 int cloexec_set; 3600 int cloexec_set;
3601#if defined(OSX) && defined(SOL_SOCKET) && defined(SO_NOSIGPIPE)
3602 static const int on_val = 1;
3603#endif
3601 3604
3602 /* use SOCK_STREAM rather than ai_socktype: some getaddrinfo 3605 /* use SOCK_STREAM rather than ai_socktype: some getaddrinfo
3603 * implementations do not set ai_socktype, e.g. RHL6.2. */ 3606 * implementations do not set ai_socktype, e.g. RHL6.2. */
@@ -3618,6 +3621,9 @@ create_listen_socket (struct MHD_Daemon *daemon,
3618 } 3621 }
3619 if (MHD_INVALID_SOCKET == fd) 3622 if (MHD_INVALID_SOCKET == fd)
3620 return MHD_INVALID_SOCKET; 3623 return MHD_INVALID_SOCKET;
3624#if defined(OSX) && defined(SOL_SOCKET) && defined(SO_NOSIGPIPE)
3625 setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &on_val, sizeof(on_val));
3626#endif
3621 if (MHD_NO == cloexec_set) 3627 if (MHD_NO == cloexec_set)
3622 make_noninheritable (daemon, fd); 3628 make_noninheritable (daemon, fd);
3623 return fd; 3629 return fd;