From cf391c36e29b2d7b8b7031f4bfe365de9fbebd9d Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Tue, 22 Nov 2011 20:02:56 -0500 Subject: [PATCH] Bash-4.2 patch 15 --- expr.c | 19 ++++++++++++++----- patchlevel.h | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/expr.c b/expr.c index 2177cfa..14cdca2 100644 --- a/expr.c +++ b/expr.c @@ -476,19 +476,23 @@ expassign () if (special) { + if ((op == DIV || op == MOD) && value == 0) + { + if (noeval == 0) + evalerror (_("division by 0")); + else + value = 1; + } + switch (op) { case MUL: lvalue *= value; break; case DIV: - if (value == 0) - evalerror (_("division by 0")); lvalue /= value; break; case MOD: - if (value == 0) - evalerror (_("division by 0")); lvalue %= value; break; case PLUS: @@ -804,7 +808,12 @@ exp2 () val2 = exppower (); if (((op == DIV) || (op == MOD)) && (val2 == 0)) - evalerror (_("division by 0")); + { + if (noeval == 0) + evalerror (_("division by 0")); + else + val2 = 1; + } if (op == MUL) val1 *= val2; diff --git a/patchlevel.h b/patchlevel.h index 04b423b..05c9cc3 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -25,6 +25,6 @@ regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh looks for to find the patch level (for the sccs version string). */ -#define PATCHLEVEL 14 +#define PATCHLEVEL 15 #endif /* _PATCHLEVEL_H_ */ -- 2.7.4