From ea2cf705d50024b09e00f8f5bf9c666429bccfa5 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Wed, 10 Mar 2010 13:29:11 +0800 Subject: [ARITH] Fix logical or result value Another change I'm making to the arith code is making || return 0 or 1 only, matching C, POSIX and other shells. Apart from the compliance issue, it is also bad to expose implementation details like the exact meaning of 'noeval' to scripts such that they may come to depend on them. Signed-off-by: Herbert Xu --- ChangeLog | 4 ++++ src/arith_yacc.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e6e82f1..0802048 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-03-10 Jilles Tjoelker + + * Fix logical or result value. + 2010-03-09 Herbert Xu * Fix binary operator parsing. diff --git a/src/arith_yacc.c b/src/arith_yacc.c index 74b95f8..6c5a720 100644 --- a/src/arith_yacc.c +++ b/src/arith_yacc.c @@ -253,7 +253,7 @@ static intmax_t or(int token, union yystype *val, int op, int noeval) b = or(token, val, yylex(), noeval | !!a); - return a | b; + return a || b; } static intmax_t cond(int token, union yystype *val, int op, int noeval) -- cgit 1.4.1