From: Denys Vlasenko Date: Fri, 4 Nov 2016 17:52:48 +0000 (+0100) Subject: hush: non-matching "case" statement sets $? to 0 X-Git-Tag: 1_26_0~87 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=30bfcf612b0862e4dd98d923eabb308b54012d24;p=oweals%2Fbusybox.git hush: non-matching "case" statement sets $? to 0 Signed-off-by: Denys Vlasenko --- diff --git a/shell/hush.c b/shell/hush.c index 336de75ad..4c2ed6cea 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; }