Bugfix ... don't override handler for sigpipe if one is set.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17902 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-10-16 15:48:48 +00:00
parent 77dfd1008b
commit 5c31ef0e4b
5 changed files with 43 additions and 12 deletions

View file

@ -1,3 +1,14 @@
Thu Oct 16 16:45:00 2003 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSFileHandle.m:
* Source/NSMessagePort.m:
* Source/NSSocketPort.m: Only ignore SIGPIPE if there is no
handler set up for it. If some other code has set up a handler
before GNUstep code is used, we should not be overriding that
handler as the external code may later depend on receiving the
signal. Many thanks to Nicola for the investigative work
leading up to this realisation.
Thu Oct 16 15:57:39 2003 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSObject.m: Do not include signal.h.

View file

@ -257,11 +257,16 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if (self == [GSFileHandle class])
{
#if !defined(__MINGW__)
void (*handler)(int);
/*
* 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 handled or 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);
handler = signal(SIGPIPE, SIG_IGN);
if (handler != SIG_DFL)
{
signal(SIGPIPE, handler);
}
#endif
}
}

View file

@ -456,11 +456,16 @@ static Class runLoopClass;
wVersionRequested = MAKEWORD(2, 0);
WSAStartup(wVersionRequested, &wsaData);
#else
void (*handler)(int);
/*
* 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 handled or 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);
handler = signal(SIGPIPE, SIG_IGN);
if (handler != SIG_DFL)
{
signal(SIGPIPE, handler);
}
#endif
mutableArrayClass = [NSMutableArray class];
mutableDataClass = [NSMutableData class];

View file

@ -368,11 +368,16 @@ static Class runLoopClass;
wVersionRequested = MAKEWORD(2, 0);
WSAStartup(wVersionRequested, &wsaData);
#else
void (*handler)(int);
/*
* 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 handled or 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);
handler = signal(SIGPIPE, SIG_IGN);
if (handler != SIG_DFL)
{
signal(SIGPIPE, handler);
}
#endif
mutableArrayClass = [NSMutableArray class];
mutableDataClass = [NSMutableData class];

View file

@ -420,11 +420,16 @@ static Class runLoopClass;
wVersionRequested = MAKEWORD(2, 0);
WSAStartup(wVersionRequested, &wsaData);
#else
void (*handler)(int);
/*
* 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 handled or 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);
handler = signal(SIGPIPE, SIG_IGN);
if (handler != SIG_DFL)
{
signal(SIGPIPE, handler);
}
#endif
mutableArrayClass = [NSMutableArray class];
mutableDataClass = [NSMutableData class];