From c41e0aedf5fc2a92502bc400010e64b8fea89d4e Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 30 May 2015 20:50:43 +0200 Subject: [PATCH] network: prevent SIGPIPE on OSX OSX does not know MSG_NOSIGNAL, and provides its own non-standard mechanism instead. I guess Apple hates standards. Signed-off-by: Michael Niedermayer --- libavformat/network.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/network.c b/libavformat/network.c index 8cc5aad6a9..47ade8cb62 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -180,6 +180,10 @@ int ff_socket(int af, int type, int proto) } #endif } +#ifdef SO_NOSIGPIPE + if (fd != -1) + setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &(int){1}, sizeof(int)); +#endif return fd; }