about summary refs log tree commit diff
path: root/Src/signals.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-09-29 08:59:31 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2014-09-29 08:59:31 -0700
commit60e31a45b0c015d42e9dc8ca2c991930c3f7fd66 (patch)
treea9718b9eb5e1041800fc7f4706bc7d3dbcbcf0ee /Src/signals.c
parent7cabee52d8132fed31767392540ae67bac36377e (diff)
downloadzsh-60e31a45b0c015d42e9dc8ca2c991930c3f7fd66.tar.gz
zsh-60e31a45b0c015d42e9dc8ca2c991930c3f7fd66.tar.xz
zsh-60e31a45b0c015d42e9dc8ca2c991930c3f7fd66.zip
33268: interactive shells treat SIGPIPE like SIGHUP if and only if SHTTY is disconnected
Diffstat (limited to 'Src/signals.c')
-rw-r--r--Src/signals.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Src/signals.c b/Src/signals.c
index cb2b58161..84a2609e5 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -594,6 +594,17 @@ zhandler(int sig)
 	wait_for_processes();
         break;
  
+    case SIGPIPE:
+	if (!handletrap(SIGPIPE)) {
+	    if (!interact)
+		_exit(SIGPIPE);
+	    else if (!isatty(SHTTY)) {
+		stopmsg = 1;
+		zexit(SIGPIPE, 1);
+	    }
+	}
+	break;
+
     case SIGHUP:
         if (!handletrap(SIGHUP)) {
             stopmsg = 1;
@@ -897,6 +908,8 @@ removetrap(int sig)
 	noholdintr();
     } else if (sig == SIGHUP)
         install_handler(sig);
+    else if (sig == SIGPIPE && interact && !forklevel)
+        install_handler(sig);
     else if (sig && sig <= SIGCOUNT &&
 #ifdef SIGWINCH
              sig != SIGWINCH &&