Ignore SIGPIPE and allow EPIPE to get through to the program so that
authorMartin Pool <mbp@samba.org>
Mon, 18 Feb 2002 20:06:57 +0000 (20:06 +0000)
committerMartin Pool <mbp@samba.org>
Mon, 18 Feb 2002 20:06:57 +0000 (20:06 +0000)
we don't get stuck in a recursive loop trying to report a broken pipe
across that same broken pipe.  Debian bug #128632 (Colin Walters)

main.c

diff --git a/main.c b/main.c
index 0ed7df3..a54d67f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -839,10 +839,13 @@ int main(int argc,char *argv[])
        }
 
        signal(SIGINT,SIGNAL_CAST sig_int);
-       signal(SIGPIPE,SIGNAL_CAST sig_int);
        signal(SIGHUP,SIGNAL_CAST sig_int);
        signal(SIGTERM,SIGNAL_CAST sig_int);
 
+       /* Ignore SIGPIPE; we consistently check error codes and will
+        * see the EPIPE. */
+       signal(SIGPIPE, SIG_IGN);
+
        /* Initialize push_dir here because on some old systems getcwd
           (implemented by forking "pwd" and reading its output) doesn't
           work when there are other child processes.  Also, on all systems