summaryrefslogtreecommitdiff
path: root/net/libupnp/patches/patch-ab
diff options
context:
space:
mode:
Diffstat (limited to 'net/libupnp/patches/patch-ab')
-rw-r--r--net/libupnp/patches/patch-ab53
1 files changed, 53 insertions, 0 deletions
diff --git a/net/libupnp/patches/patch-ab b/net/libupnp/patches/patch-ab
new file mode 100644
index 00000000000..6b842a793d9
--- /dev/null
+++ b/net/libupnp/patches/patch-ab
@@ -0,0 +1,53 @@
+$NetBSD: patch-ab,v 1.1.1.1 2006/06/03 23:29:24 rh Exp $
+
+--- upnp/src/genlib/net/sock.c.orig 2006-02-23 07:38:03.000000000 +1000
++++ upnp/src/genlib/net/sock.c
+@@ -49,6 +49,10 @@
+ #include <unistd.h>
+ #include "unixutil.h"
+
++#ifndef MSG_NOSIGNAL
++#define MSG_NOSIGNAL 0
++#endif
++
+ /************************************************************************
+ * Function : sock_init
+ *
+@@ -223,6 +227,15 @@ sock_read_write( IN SOCKINFO * info,
+ }
+ }
+
++#ifdef SO_NOSIGPIPE
++ {
++ int old;
++ int set = 1;
++ socklen_t olen = sizeof(old);
++ getsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, &olen);
++ setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(set));
++#endif
++
+ if( bRead ) {
+ // read data
+ numBytes = recv( sockfd, buffer, bufsize, MSG_NOSIGNAL );
+@@ -235,6 +248,9 @@ sock_read_write( IN SOCKINFO * info,
+ send( sockfd, buffer + bytes_sent, byte_left,
+ MSG_DONTROUTE | MSG_NOSIGNAL );
+ if( num_written == -1 ) {
++#ifdef SO_NOSIGPIPE
++ setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
++#endif
+ return num_written;
+ }
+
+@@ -245,6 +261,11 @@ sock_read_write( IN SOCKINFO * info,
+ numBytes = bytes_sent;
+ }
+
++#ifdef SO_NOSIGPIPE
++ setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
++ }
++#endif
++
+ if( numBytes < 0 ) {
+ return UPNP_E_SOCKET_ERROR;
+ }