diff options
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 6 |
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; |