Commit 881b80b3 authored by wm4's avatar wm4 Committed by Martin Storsjö

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: 's avatarMartin Storsjö <martin@martin.st>
parent 0181ae9a
...@@ -153,6 +153,10 @@ int ff_socket(int af, int type, int proto) ...@@ -153,6 +153,10 @@ int ff_socket(int af, int type, int proto)
fcntl(fd, F_SETFD, FD_CLOEXEC); fcntl(fd, F_SETFD, FD_CLOEXEC);
#endif #endif
} }
#ifdef SO_NOSIGPIPE
if (fd != -1)
setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &(int){1}, sizeof(int));
#endif
return fd; return fd;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment