From 5f598e26490550642e03824202665f5021d8628a Mon Sep 17 00:00:00 2001 From: toddouska Date: Tue, 2 Oct 2012 22:02:50 -0700 Subject: [PATCH] SIGPIPE ignore if no SO_NOSIGPIPE --- cyassl/test.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cyassl/test.h b/cyassl/test.h index ca7ad0bac..f73f68c61 100644 --- a/cyassl/test.h +++ b/cyassl/test.h @@ -37,6 +37,9 @@ #include #endif #define SOCKET_T int + #ifndef SO_NOSIGPIPE + #include /* ignore SIGPIPE */ + #endif #endif /* USE_WINDOWS_API */ #ifdef _MSC_VER @@ -354,7 +357,9 @@ static INLINE void tcp_socket(SOCKET_T* sockfd, SOCKADDR_IN_T* addr, if (res < 0) err_sys("setsockopt SO_NOSIGPIPE failed\n"); } -#endif +#else /* no S_NOSIGPIPE */ + signal(SIGPIPE, SIG_IGN); +#endif /* S_NOSIGPIPE */ #if defined(TCP_NODELAY) if (!udp)