[BusyBox-cvs] busybox/shell ash.c,1.81,1.82

Erik Andersen andersen at busybox.net
Wed Oct 22 10:56:51 UTC 2003


Update of /var/cvs/busybox/shell
In directory winder:/tmp/cvs-serv12416/shell

Modified Files:
	ash.c 
Log Message:
last_patch116 from vodz:

Stephane,

>Using busybox+uclibc, crond syslog messages look like:
>
>Oct  9 09:04:46 soekris cron.notice crond[347]: ^Icrond 2.3.2 dillon,
>started, log level 8

Thanks for testing.

>The attached patch corrects the problem.

Your patch is not correct.
Correct patch attached.

Also. Last patch have
- add "Broken pipe" message to ash.c
- busybox ash synced with dash_0.4.18

--w
vodz



Index: ash.c
===================================================================
RCS file: /var/cvs/busybox/shell/ash.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- ash.c	17 Sep 2003 00:22:26 -0000	1.81
+++ ash.c	22 Oct 2003 10:56:47 -0000	1.82
@@ -6682,18 +6682,24 @@
 	int st;
 
 	col = 0;
-	st = WEXITSTATUS(status);
 	if (!WIFEXITED(status)) {
-		st = WTERMSIG(status);
 #if JOBS
 		if (WIFSTOPPED(status))
 			st = WSTOPSIG(status);
+		else
 #endif
+			st = WTERMSIG(status);
 		if (sigonly) {
-			if (st == SIGINT || st == SIGPIPE)
+			if(st == SIGPIPE) {
+				col = fmtstr(s, 16, "Broken pipe");
 				goto out;
+			}
+			if (st == SIGINT)
+				goto out;
+#if JOBS
 			if (WIFSTOPPED(status))
 				goto out;
+#endif
 		}
 		st &= 0x7f;
 		col = fmtstr(s, 32, u_signal_names(NULL, &st, 0));
@@ -6701,6 +6707,7 @@
 			col += fmtstr(s + col, 16, " (core dumped)");
 		}
 	} else if (!sigonly) {
+		st = WEXITSTATUS(status);
 		if (st)
 			col = fmtstr(s, 16, "Done(%d)", st);
 		else
@@ -9036,18 +9043,19 @@
 	char c = '?';
 	int done = 0;
 	int err = 0;
-	char s[10];
-	char **optnext = optfirst + *param_optind - 1;
+	char s[12];
+	char **optnext;
 
-	if (*param_optind <= 1 || *optoff < 0 || !(*(optnext - 1)) ||
-	    strlen(*(optnext - 1)) < *optoff)
+	if(*param_optind < 1)
+		return 1;
+	optnext = optfirst + *param_optind - 1;
+
+	if (*param_optind <= 1 || *optoff < 0 || strlen(optnext[-1]) < *optoff)
 		p = NULL;
 	else
-		p = *(optnext - 1) + *optoff;
+		p = optnext[-1] + *optoff;
 	if (p == NULL || *p == '\0') {
 		/* Current word is done, advance */
-		if (optnext == NULL)
-			return 1;
 		p = *optnext;
 		if (p == NULL || *p != '-' || *++p == '\0') {
 atend:




More information about the busybox-cvs mailing list