OS X version of MSG_NOSIGNAL
authorHeikki Lindholm <holin@iki.fi>
Sat, 17 Oct 2009 20:58:41 +0000 (20:58 +0000)
committerHeikki Lindholm <holin@iki.fi>
Sat, 17 Oct 2009 20:58:41 +0000 (20:58 +0000)
src/util/network.c

index 9a38dc098b5a586d8b9f38fac544272c6be827b2..5ba849138039aac36b079c8c7ccfbf7f3cf27fdd 100644 (file)
@@ -333,6 +333,13 @@ GNUNET_NETWORK_socket_send (const struct GNUNET_NETWORK_Handle * desc,
 {\r
   int ret;\r
   int flags;\r
+#ifdef OSX\r
+  int no_sigpipe;\r
+  no_sigpipe = 1;\r
+  /* shouldn't matter if this fails as there's a SIGPIPE handler */\r
+  ret = setsockopt (desc->fd, SOL_SOCKET, SO_NOSIGPIPE,\r
+                    (void *) &no_sigpipe, sizeof (no_sigpipe));\r
+#endif\r
 \r
   flags = 0;\r
 #ifdef MSG_DONTWAIT\r
@@ -370,6 +377,13 @@ GNUNET_NETWORK_socket_sendto (const struct GNUNET_NETWORK_Handle * desc,
 {\r
   int ret;\r
   int flags;\r
+#ifdef OSX\r
+  int no_sigpipe;\r
+  no_sigpipe = 1;\r
+  /* shouldn't matter if this fails as there's a SIGPIPE handler */\r
+  ret = setsockopt (desc->fd, SOL_SOCKET, SO_NOSIGPIPE,\r
+                    (void *) &no_sigpipe, sizeof (no_sigpipe));\r
+#endif\r
 \r
   flags = 0;\r
 #ifdef MSG_DONTWAIT\r