Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/sh PR/50960: The || and && operators in $(( )) should a...
details: https://anonhg.NetBSD.org/src/rev/5b348d866340
branches: trunk
changeset: 344174:5b348d866340
user: christos <christos%NetBSD.org@localhost>
date: Wed Mar 16 15:43:38 2016 +0000
description:
PR/50960: The || and && operators in $(( )) should always have a 0 or 1
result, never anything different. (from kre)
diffstat:
bin/sh/arith.y | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (30 lines):
diff -r ee493abf2229 -r 5b348d866340 bin/sh/arith.y
--- a/bin/sh/arith.y Wed Mar 16 15:42:33 2016 +0000
+++ b/bin/sh/arith.y Wed Mar 16 15:43:38 2016 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: arith.y,v 1.23 2016/03/16 15:42:33 christos Exp $ */
+/* $NetBSD: arith.y,v 1.24 2016/03/16 15:43:38 christos Exp $ */
/*-
* Copyright (c) 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)arith.y 8.3 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: arith.y,v 1.23 2016/03/16 15:42:33 christos Exp $");
+__RCSID("$NetBSD: arith.y,v 1.24 2016/03/16 15:43:38 christos Exp $");
#endif
#endif /* not lint */
@@ -91,8 +91,8 @@
expr: ARITH_LPAREN expr ARITH_RPAREN { $$ = $2; }
| expr ARITH_QM expr ARITH_COLON expr { $$ = $1 ? $3 : $5; }
- | expr ARITH_OR expr { $$ = $1 ? $1 : $3 ? $3 : 0; }
- | expr ARITH_AND expr { $$ = $1 ? ( $3 ? $3 : 0 ) : 0; }
+ | expr ARITH_OR expr { $$ = ($1 ? 1 : $3 ? 1 : 0); }
+ | expr ARITH_AND expr { $$ = ($1 ? ( $3 ? 1 : 0 ) : 0); }
| expr ARITH_BOR expr { $$ = $1 | $3; }
| expr ARITH_BXOR expr { $$ = $1 ^ $3; }
| expr ARITH_BAND expr { $$ = $1 & $3; }
Home |
Main Index |
Thread Index |
Old Index