diff options
author | Gerrit Pape <pape@smarden.org> | 2008-05-07 11:15:52 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2008-05-07 11:15:52 +0800 |
commit | 065c7bfc0cb928e9f51ee9597d41d5604acff68a (patch) | |
tree | 555a715f3282eab32703d78da0467aade765656d /src | |
parent | [SHELL] Added gitignore (diff) | |
download | dash-065c7bfc0cb928e9f51ee9597d41d5604acff68a.tar.gz dash-065c7bfc0cb928e9f51ee9597d41d5604acff68a.zip |
[ARITH] Fixed lexical error on & and |
The parser used to skip a byte when parsing the & and | operators, testcase: $ dash -c 'echo $((7&1))' $ dash -c 'echo $((7& 1))' $ dash -c 'echo $((7&11))' Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | src/arith_yylex.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/arith_yylex.c b/src/arith_yylex.c index c4458a4..ec5b5b2 100644 --- a/src/arith_yylex.c +++ b/src/arith_yylex.c @@ -141,7 +141,9 @@ yylex() case '=': value += ARITH_ASS - '='; checkeq: - if (*++buf != '=') + buf++; +checkeqcur: + if (*buf != '=') goto out; value += 11; break; @@ -174,14 +176,14 @@ checkeq: case '|': if (*++buf != '|') { value += ARITH_BOR - '|'; - goto checkeq; + goto checkeqcur; } value += ARITH_OR - '|'; break; case '&': if (*++buf != '&') { value += ARITH_BAND - '&'; - goto checkeq; + goto checkeqcur; } value += ARITH_AND - '&'; break; |