OSX does not know MSG_NOSIGNAL, and provides its own non-standard
mechanism instead. I guess Apple hates standards.
---
Haven't really checked whether this really prevents SIGPIPE (too
bothersome to test), only that the function call succeeds. I don't
think there's a reason to check the success normally, though, so
this patch comes without a check.
---
 libavformat/network.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/network.c b/libavformat/network.c
index a12e70d..2c34b4a 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -153,6 +153,10 @@ int ff_socket(int af, int type, int proto)
             fcntl(fd, F_SETFD, FD_CLOEXEC);
 #endif
     }
+#ifdef SO_NOSIGPIPE
+    if (fd != -1)
+        setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &(int){1}, sizeof(int));
+#endif
     return fd;
 }
 
-- 
2.1.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to