svn commit: [26149] trunk/busybox/shell

vda at busybox.net vda at busybox.net
Sat Apr 18 13:05:10 UTC 2009


Author: vda
Date: 2009-04-18 13:05:10 +0000 (Sat, 18 Apr 2009)
New Revision: 26149

Log:
hush: fix thinko in error msg



Modified:
   trunk/busybox/shell/hush.c


Changeset:
Modified: trunk/busybox/shell/hush.c
===================================================================
--- trunk/busybox/shell/hush.c	2009-04-18 12:58:19 UTC (rev 26148)
+++ trunk/busybox/shell/hush.c	2009-04-18 13:05:10 UTC (rev 26149)
@@ -6430,7 +6430,6 @@
 
 static int builtin_trap(char **argv)
 {
-	int i;
 	int sig;
 	char *new_cmd;
 
@@ -6439,6 +6438,7 @@
 
 	argv++;
 	if (!*argv) {
+		int i;
 		/* No args: print all trapped */
 		for (i = 0; i < NSIG; ++i) {
 			if (G.traps[i]) {
@@ -6452,7 +6452,6 @@
 	}
 
 	new_cmd = NULL;
-	i = 0;
 	/* If first arg is a number: reset all specified signals */
 	sig = bb_strtou(*argv, NULL, 10);
 	if (errno == 0) {
@@ -6464,7 +6463,7 @@
 			if (sig < 0 || sig >= NSIG) {
 				ret = EXIT_FAILURE;
 				/* Mimic bash message exactly */
-				bb_perror_msg("trap: %s: invalid signal specification", argv[i]);
+				bb_perror_msg("trap: %s: invalid signal specification", argv[-1]);
 				continue;
 			}
 
@@ -6488,8 +6487,8 @@
 					continue;
 				sigdelset(&G.blocked_set, sig);
 			}
-			sigprocmask(SIG_SETMASK, &G.blocked_set, NULL);
 		}
+		sigprocmask(SIG_SETMASK, &G.blocked_set, NULL);
 		return ret;
 	}
 



More information about the busybox-cvs mailing list