diff --git a/bin/sh/arith_yacc.c b/bin/sh/arith_yacc.c index 8aab8fbcb1a3..edb321ff05f2 100644 --- a/bin/sh/arith_yacc.c +++ b/bin/sh/arith_yacc.c @@ -198,7 +198,7 @@ static arith_t primary(int token, union yystype *val, int op, int noeval) } } -static arith_t binop2(arith_t a, int op, int prec, int noeval) +static arith_t binop2(arith_t a, int op, int precedence, int noeval) { for (;;) { union yystype val; @@ -221,7 +221,7 @@ static arith_t binop2(arith_t a, int op, int prec, int noeval) a = noeval ? b : do_binop(op, a, b); if (op2 < ARITH_BINOP_MIN || op2 >= ARITH_BINOP_MAX || - arith_prec(op2) >= prec) + arith_prec(op2) >= precedence) return a; op = op2; diff --git a/bin/sh/arith_yylex.c b/bin/sh/arith_yylex.c index 0d08a831ff0c..08e43a488b15 100644 --- a/bin/sh/arith_yylex.c +++ b/bin/sh/arith_yylex.c @@ -57,6 +57,7 @@ yylex() { int value; const char *buf = arith_buf; + char *end; const char *p; for (;;) { @@ -79,7 +80,8 @@ yylex() case '7': case '8': case '9': - yylval.val = strtoarith_t(buf, (char **)&arith_buf, 0); + yylval.val = strtoarith_t(buf, (char **)&end, 0); + arith_buf = end; return ARITH_NUM; case 'A': case 'B':