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>
pull/116/merge
wm4 10 years ago committed by Martin Storsjö
parent 0181ae9af2
commit 881b80b329
  1. 4
      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;
}

Loading…
Cancel
Save