aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/mhd_sockets.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/mhd_sockets.c')
-rw-r--r--src/microhttpd/mhd_sockets.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/microhttpd/mhd_sockets.c b/src/microhttpd/mhd_sockets.c
index 3bd48f58..9b60e224 100644
--- a/src/microhttpd/mhd_sockets.c
+++ b/src/microhttpd/mhd_sockets.c
@@ -473,9 +473,6 @@ MHD_socket_create_listen_ (int use_ipv6)
473 int domain; 473 int domain;
474 MHD_socket fd; 474 MHD_socket fd;
475 int cloexec_set; 475 int cloexec_set;
476#if defined(OSX) && defined(SOL_SOCKET) && defined(SO_NOSIGPIPE)
477 static const int on_val = 1;
478#endif
479 476
480#ifdef HAVE_INET6 477#ifdef HAVE_INET6
481 domain = (use_ipv6) ? PF_INET6 : PF_INET; 478 domain = (use_ipv6) ? PF_INET6 : PF_INET;
@@ -510,19 +507,15 @@ MHD_socket_create_listen_ (int use_ipv6)
510 } 507 }
511 if (MHD_INVALID_SOCKET == fd) 508 if (MHD_INVALID_SOCKET == fd)
512 return MHD_INVALID_SOCKET; 509 return MHD_INVALID_SOCKET;
513#if defined(OSX) && defined(SOL_SOCKET) && defined(SO_NOSIGPIPE) 510#ifdef MHD_socket_nosignal_
514 if(0 != setsockopt(fd, 511 if(! MHD_socket_nosignal_(fd))
515 SOL_SOCKET,
516 SO_NOSIGPIPE,
517 &on_val,
518 sizeof (on_val)))
519 { 512 {
520 int err = MHD_socket_get_error_ (); 513 const int err = MHD_socket_get_error_ ();
521 MHD_socket_close_ (fd); 514 MHD_socket_close_ (fd);
522 MHD_socket_fset_error_ (err); 515 MHD_socket_fset_error_ (err);
523 return MHD_INVALID_SOCKET; 516 return MHD_INVALID_SOCKET;
524 } 517 }
525#endif 518#endif /* MHD_socket_nosignal_ */
526 if (! cloexec_set) 519 if (! cloexec_set)
527 (void) MHD_socket_noninheritable_ (fd); 520 (void) MHD_socket_noninheritable_ (fd);
528 521