Ignore SIGPIPE on POSIX platforms to fix the crash on connection closure in Limelight-iOS

This commit is contained in:
Cameron Gutman
2014-10-20 23:27:41 -04:00
parent df9ba620e8
commit 25faaa9e6b
2 changed files with 13 additions and 0 deletions
+11
View File
@@ -68,6 +68,17 @@ int initializePlatformSockets(void) {
#if defined(LC_WINDOWS) || defined(LC_WINDOWS_PHONE)
WSADATA data;
return WSAStartup(MAKEWORD(2, 0), &data);
#elif defined(LC_POSIX)
// Disable SIGPIPE signals to avoid us getting
// killed when a socket gets an EPIPE error
struct sigaction sa;
sa.sa_handler = SIG_IGN;
sa.sa_flags = 0;
if (sigaction(SIGPIPE, &sa, 0) == -1) {
perror("sigaction");
return -1;
}
return 0;
#else
return 0;
#endif