summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2002-11-08 10:43:48 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2002-11-08 10:43:48 +0000
commit2c75ac82e9902818a229d51ace1aa077356a3b63 (patch)
tree33e4ce867c8818108a404e4472ac6df9165dfc56
parent83b3b0769a11b1fb8060695efb72c17a55d04cea (diff)
downloadzsh-2c75ac82e9902818a229d51ace1aa077356a3b63.tar.gz
zsh-2c75ac82e9902818a229d51ace1aa077356a3b63.tar.xz
zsh-2c75ac82e9902818a229d51ace1aa077356a3b63.zip
17861 from Philippe Troin: make signal initialisation more consistent
-rw-r--r--ChangeLog7
-rw-r--r--Src/init.c32
2 files changed, 16 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 68c91d838..2b3f2f486 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-11-08  Peter Stephenson  <pws@csr.com>
+
+	* 17861: Philippe Troin <phil@fifi.org>: Src/init.c: Improve
+	initialisation of signals.  Allow shell to get SIGTERM; remove
+	duplicate attachtty() code; initialise signal mask consistently
+	in interactive shells, resetting ignored signals, too.
+
 2002-11-06  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* 17910: Bart (17906): de-quote prefix when calling compfiles to
diff --git a/Src/init.c b/Src/init.c
index dca115eb6..67ed1815b 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -883,6 +883,12 @@ setupvals(void)
 void
 init_signals(void)
 {
+    if (interact) {
+	int i;
+	signal_setmask(signal_mask(0));
+	for (i=0; i<NSIG; ++i)
+	    signal_default(i);
+    }
     sigchld_mask = signal_mask(SIGCHLD);
 
     intr();
@@ -898,31 +904,11 @@ init_signals(void)
 #endif
     if (interact) {
 	install_handler(SIGALRM);
-	signal_ignore(SIGTERM);
     }
     if (jobbing) {
-	long ttypgrp;
-
-	while ((ttypgrp = gettygrp()) != -1 && ttypgrp != mypgrp)
-	    kill(0, SIGTTIN);
-	if (ttypgrp == -1) {
-	    opts[MONITOR] = 0;
-	} else {
-	    signal_ignore(SIGTTOU);
-	    signal_ignore(SIGTSTP);
-	    signal_ignore(SIGTTIN);
-	    attachtty(mypgrp);
-	}
-    }
-    if (islogin) {
-	signal_setmask(signal_mask(0));
-    } else if (interact) {
-	sigset_t set;
-
-	sigemptyset(&set);
-	sigaddset(&set, SIGINT);
-	sigaddset(&set, SIGQUIT);
-	signal_unblock(set);
+	signal_ignore(SIGTTOU);
+	signal_ignore(SIGTSTP);
+	signal_ignore(SIGTTIN);
     }
 }