From 6c1e49239f48e5d4dc4f0e3c27d3bf4f2abd2e59 Mon Sep 17 00:00:00 2001 From: CaS Date: Fri, 27 Sep 2002 16:08:49 +0000 Subject: [PATCH] Ignore SIGPIPE git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14592 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/GSTcpPort.m | 12 +++++++++++- Source/UnixFileHandle.m | 4 ++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c1019aa88..cb60c4e13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-09-27 Richard Frith-Macdonald + + * Source/GSTcpPort.m: ([GSTcphandle+initialize]) ignore SIGPIPE in + case a socket gets closed while we are writing. + 2002-09-26 Richard Frith-Macdonald * Source/Additions/GSMime.m: Fix typo. diff --git a/Source/GSTcpPort.m b/Source/GSTcpPort.m index fca7c3a48..2f8223cbd 100644 --- a/Source/GSTcpPort.m +++ b/Source/GSTcpPort.m @@ -41,7 +41,12 @@ #include #include #include +#ifdef HAVE_SYS_SIGNAL_H +#include +#endif +#ifdef HAVE_SIGNAL_H #include +#endif #ifdef HAVE_UNISTD_H #include /* for gethostname() */ #endif @@ -66,7 +71,6 @@ #include #include #include -#include #include #include /* @@ -443,6 +447,12 @@ static Class runLoopClass; wVersionRequested = MAKEWORD(2, 0); WSAStartup(wVersionRequested, &wsaData); +#else + /* + * If SIGPIPE is not ignored, we will abort on any attempt to + * write to a pipe/socket that has been closed by the other end! + */ + signal(SIGPIPE, SIG_IGN); #endif mutableArrayClass = [NSMutableArray class]; mutableDataClass = [NSMutableData class]; diff --git a/Source/UnixFileHandle.m b/Source/UnixFileHandle.m index b249a9cb9..e022c1403 100644 --- a/Source/UnixFileHandle.m +++ b/Source/UnixFileHandle.m @@ -198,8 +198,8 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin) { #if !defined(__MINGW__) /* - * If SIGPIPE is not ignored, we will abort on any attempt to - * write to a pipe/socket that has been closed by the other end! + * If SIGPIPE is not ignored, we will abort on any attempt to + * write to a pipe/socket that has been closed by the other end! */ signal(SIGPIPE, SIG_IGN); #endif