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 <michaelni@gmx.at>
This commit is contained in:
wm4 2015-05-30 20:50:43 +02:00 committed by Michael Niedermayer
parent e9d646f44c
commit c41e0aedf5
1 changed files with 4 additions and 0 deletions

View File

@ -180,6 +180,10 @@ int ff_socket(int af, int type, int proto)
} }
#endif #endif
} }
#ifdef SO_NOSIGPIPE
if (fd != -1)
setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &(int){1}, sizeof(int));
#endif
return fd; return fd;
} }