about summary refs log tree commit diff
path: root/Src/signals.c
diff options
context:
space:
mode:
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 74a39e5fb..2df69f96e 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 &&