[git commit] hush: non-matching "case" statement sets $? to 0

Denys Vlasenko vda.linux at googlemail.com
Fri Nov 4 17:52:48 UTC 2016


commit: https://git.busybox.net/busybox/commit/?id=30bfcf612b0862e4dd98d923eabb308b54012d24
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/hush.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/shell/hush.c b/shell/hush.c
index 336de75..4c2ed6c 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -7874,6 +7874,8 @@ static int run_list(struct pipe *pi)
 #endif
 #if ENABLE_HUSH_CASE
 		if (rword == RES_CASE) {
+			/* Case which does not match and execute anything still sets $? to 0 */
+			G.last_exitcode = rcode = EXIT_SUCCESS;
 			case_word = expand_strvec_to_string(pi->cmds->argv);
 			continue;
 		}


More information about the busybox-cvs mailing list