Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 573f6ba228a443105a16491b27786576 > files > 14

busybox-1.2.0-13.el5.src.rpm

diff -d -urpN busybox.4/shell/hush.c busybox.5/shell/hush.c
--- busybox.4/shell/hush.c	2011-05-16 11:37:14.000000000 +0200
+++ busybox.5/shell/hush.c	2011-05-31 17:11:16.058397249 +0200
@@ -7498,7 +7498,10 @@ static int run_list(struct pipe *pi)
 #endif
 #if ENABLE_HUSH_LOOPS
 		/* Beware of "while false; true; do ..."! */
-		if (pi->next && pi->next->res_word == RES_DO) {
+		if (pi->next
+		 && (pi->next->res_word == RES_DO || pi->next->res_word == RES_DONE)
+		/* (the second check above is needed for "while ...; do \n done" case) */
+		) {
 			if (rword == RES_WHILE) {
 				if (rcode) {
 					/* "while false; do...done" - exitcode 0 */