From 6c250f6d53ecd29a1443e794f4beedcff7c55936 Mon Sep 17 00:00:00 2001 From: CaS Date: Mon, 1 Dec 2003 06:55:40 +0000 Subject: [PATCH] fix for ignoring of sigpipe. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18244 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSObject.m | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ae9b0cc4..08c462c84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-12-01 Richard Frith-Macdonald + + * Source/NSObject.m: Fix error setting sigpipe handling where + sigaction is available. + 2003-11-30 Richard Frith-Macdonald * Source/NSNumber.m: Raise exception if user code incorrectly tries diff --git a/Source/NSObject.m b/Source/NSObject.m index e26935bce..a51722cd0 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -877,11 +877,16 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) { struct sigaction act; - if (sigaction(SIGPIPE, 0, &act) == 0 && act.sa_handler == SIG_DFL) + if (sigaction(SIGPIPE, 0, &act) == 0) { - if (sigaction(SIGPIPE, &act, 0) != 0) + if (act.sa_handler == SIG_DFL) { - fprintf(stderr, "Unable to ignore SIGPIPE\n"); + // Not ignored or handled ... so we ignore it. + act.sa_handler = SIG_IGN; + if (sigaction(SIGPIPE, &act, 0) != 0) + { + fprintf(stderr, "Unable to ignore SIGPIPE\n"); + } } } else