svn commit: trunk/busybox/shell

vda at busybox.net vda at busybox.net
Wed Mar 21 20:17:27 UTC 2007


Author: vda
Date: 2007-03-21 13:17:27 -0700 (Wed, 21 Mar 2007)
New Revision: 18198

Log:
ash: fix signal handling


Modified:
   trunk/busybox/shell/ash.c


Changeset:
Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2007-03-21 18:15:02 UTC (rev 18197)
+++ trunk/busybox/shell/ash.c	2007-03-21 20:17:27 UTC (rev 18198)
@@ -183,7 +183,7 @@
 /* do we generate EXSIG events */
 static int exsig;
 /* last pending signal */
-static volatile sig_atomic_t pendingsigs;
+static volatile sig_atomic_t pendingsig;
 
 /*
  * Sigmode records the current value of the signal handlers for the various
@@ -239,8 +239,15 @@
 raise_interrupt(void)
 {
 	int i;
+	sigset_t mask;
 
 	intpending = 0;
+	/* Signal is not automatically re-enabled after it is raised,
+	 * do it ourself */
+	sigemptyset(&mask);
+	sigprocmask(SIG_SETMASK, &mask, 0);
+	/* pendingsig = 0; - now done in onsig() */
+
 	i = EXSIG;
 	if (gotsig[SIGINT - 1] && !trap[SIGINT]) {
 		if (!(rootshell && iflag)) {
@@ -300,7 +307,7 @@
 	do { \
 		exsig++; \
 		xbarrier(); \
-		if (pendingsigs) \
+		if (pendingsig) \
 			raise_exception(EXSIG); \
 	} while (0)
 /* EXSIG is turned off by evalbltin(). */
@@ -324,11 +331,13 @@
 onsig(int signo)
 {
 	gotsig[signo - 1] = 1;
-	pendingsigs = signo;
+	pendingsig = signo;
 
 	if (exsig || (signo == SIGINT && !trap[SIGINT])) {
-		if (!suppressint)
+		if (!suppressint) {
+			pendingsig = 0;
 			raise_interrupt();
+		}
 		intpending = 1;
 	}
 }
@@ -7441,7 +7450,7 @@
 	int skip = 0;
 
 	savestatus = exitstatus;
-	pendingsigs = 0;
+	pendingsig = 0;
 	xbarrier();
 
 	for (i = 0, q = gotsig; i < NSIG - 1; i++, q++) {
@@ -7580,7 +7589,7 @@
  out:
 	if ((checkexit & exitstatus))
 		evalskip |= SKIPEVAL;
-	else if (pendingsigs && dotrap())
+	else if (pendingsig && dotrap())
 		goto exexit;
 
 	if (flags & EV_EXIT) {
@@ -8447,7 +8456,7 @@
 			if (i == EXINT)
 				j = SIGINT;
 			if (i == EXSIG)
-				j = pendingsigs;
+				j = pendingsig;
 			if (j)
 				exit_status = j + 128;
 			exitstatus = exit_status;




More information about the busybox-cvs mailing list