summary refs log tree commit diff
diff options
context:
space:
mode:
-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);
     }
 }