aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-01-03 11:47:50 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2017-01-03 11:47:50 +0100
commitb05bcaf29c9008799aedb535cb42d2e60cc4cbb9 (patch)
treeb4ccf5173ce6234a653f5890bb6108af8988b296
parentea7d2f6ec0596789fc5b2e3fca3b7a602bfa2c26 (diff)
downloadbusybox-w32-b05bcaf29c9008799aedb535cb42d2e60cc4cbb9.tar.gz
busybox-w32-b05bcaf29c9008799aedb535cb42d2e60cc4cbb9.tar.bz2
busybox-w32-b05bcaf29c9008799aedb535cb42d2e60cc4cbb9.zip
hush: correct exitcode for unterminated ')' - exitcode2.tests testcase
function old new delta parse_stream 2595 2609 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/shell/hush.c b/shell/hush.c
index fecc89294..a56d3b280 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1137,6 +1137,9 @@ static void syntax_error_unexpected_ch(unsigned lineno UNUSED_PARAM, int ch)
1137 char msg[2]; 1137 char msg[2];
1138 msg[0] = ch; 1138 msg[0] = ch;
1139 msg[1] = '\0'; 1139 msg[1] = '\0';
1140#if HUSH_DEBUG >= 2
1141 bb_error_msg("hush.c:%u", lineno);
1142#endif
1140 bb_error_msg("syntax error: unexpected %s", ch == EOF ? "EOF" : msg); 1143 bb_error_msg("syntax error: unexpected %s", ch == EOF ? "EOF" : msg);
1141} 1144}
1142 1145
@@ -4997,7 +5000,8 @@ static struct pipe *parse_stream(char **pstring,
4997 * if we see {, we call parse_group(..., end_trigger='}') 5000 * if we see {, we call parse_group(..., end_trigger='}')
4998 * and it will match } earlier (not here). */ 5001 * and it will match } earlier (not here). */
4999 syntax_error_unexpected_ch(ch); 5002 syntax_error_unexpected_ch(ch);
5000 goto parse_error; 5003 G.last_exitcode = 2;
5004 goto parse_error1;
5001 default: 5005 default:
5002 if (HUSH_DEBUG) 5006 if (HUSH_DEBUG)
5003 bb_error_msg_and_die("BUG: unexpected %c\n", ch); 5007 bb_error_msg_and_die("BUG: unexpected %c\n", ch);
@@ -5005,6 +5009,8 @@ static struct pipe *parse_stream(char **pstring,
5005 } /* while (1) */ 5009 } /* while (1) */
5006 5010
5007 parse_error: 5011 parse_error:
5012 G.last_exitcode = 1;
5013 parse_error1:
5008 { 5014 {
5009 struct parse_context *pctx; 5015 struct parse_context *pctx;
5010 IF_HAS_KEYWORDS(struct parse_context *p2;) 5016 IF_HAS_KEYWORDS(struct parse_context *p2;)
@@ -5038,7 +5044,6 @@ static struct pipe *parse_stream(char **pstring,
5038 } while (HAS_KEYWORDS && pctx); 5044 } while (HAS_KEYWORDS && pctx);
5039 5045
5040 o_free(&dest); 5046 o_free(&dest);
5041 G.last_exitcode = 1;
5042#if !BB_MMU 5047#if !BB_MMU
5043 if (pstring) 5048 if (pstring)
5044 *pstring = NULL; 5049 *pstring = NULL;