summaryrefslogtreecommitdiff
path: root/expr.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2014-01-29 17:00:07 -0500
committerChet Ramey <chet.ramey@case.edu>2014-01-29 17:00:07 -0500
commitb6e23235f28b1c85e18e9a2b7ba8c6b6c46aecbc (patch)
tree00fdd9c37c261d89c994fc1856252df719afec3a /expr.c
parent8581f42df9a1b1d848e2d4bdf3cc951b8d14b5be (diff)
downloadbash-4.3-testing.tar.gz
bash-4.3-rc2 overlaybash-4.3-rc2bash-4.3-testing
Diffstat (limited to 'expr.c')
-rw-r--r--expr.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/expr.c b/expr.c
index 5e73e9f0..1462c102 100644
--- a/expr.c
+++ b/expr.c
@@ -839,7 +839,9 @@ exp2 ()
(curtok == MOD))
{
int op = curtok;
+ char *stp, *sltp;
+ stp = tp;
readtok ();
val2 = exppower ();
@@ -848,7 +850,14 @@ exp2 ()
if (((op == DIV) || (op == MOD)) && (val2 == 0))
{
if (noeval == 0)
- evalerror (_("division by 0"));
+ {
+ sltp = lasttp;
+ lasttp = stp;
+ while (lasttp && *lasttp && whitespace (*lasttp))
+ lasttp++;
+ evalerror (_("division by 0"));
+ lasttp = sltp;
+ }
else
val2 = 1;
}