aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2015-05-28 18:23:27 +0200
committerMartin Storsjö <martin@martin.st>2015-05-31 10:10:16 +0300
commit881b80b3294483696a21b21a69fa5eee30f33037 (patch)
treead5ff11574bd30fc2a3c6c59e548065f2c6e67dd /libavformat
parent0181ae9af2de1526464d23209b82e6674d362f5d (diff)
downloadffmpeg-881b80b3294483696a21b21a69fa5eee30f33037.tar.gz
network: prevent SIGPIPE on OSX
OSX does not know MSG_NOSIGNAL. BSD (which OSX is based on) has got the socket option SO_NOSIGPIPE (even if modern BSDs also support MSG_NOSIGNAL). Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/network.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/network.c b/libavformat/network.c
index a12e70dd04..2c34b4a14b 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;
}