Gitweb:
http://git.exim.org/exim.git/commitdiff/a5b5269546e02d1f2e90000e79df8409d4f269db
Commit: a5b5269546e02d1f2e90000e79df8409d4f269db
Parent: 54e7ce4ad20a6977ee895a358259122bf3630090
Author: Phil Pennock <pdp@???>
AuthorDate: Tue Apr 12 16:26:44 2011 -0400
Committer: Phil Pennock <pdp@???>
CommitDate: Tue Apr 12 16:26:44 2011 -0400
Also ${eval:x % 0} fixed to not SIGFPE.
Pointed out by: Steven A. Reisman
---
src/src/expand.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/src/src/expand.c b/src/src/expand.c
index 06e0eb0..fece8c1 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -3106,18 +3106,21 @@ if (*error == NULL)
int op = *s++;
int y = eval_op_unary(&s, decimal, error);
if (*error != NULL) break;
- if (op == '*') x *= y;
- else if (op == '/')
+ if (op == '*')
+ x *= y;
+ else
+ {
+ if (y == 0)
{
- if (y == 0)
- {
- *error = US"divide by zero";
- x = 0;
- break;
- }
- x /= y;
+ *error = (op == '/') ? US"divide by zero" : US"modulo by zero";
+ x = 0;
+ break;
}
- else x %= y;
+ if (op == '/')
+ x /= y;
+ else
+ x %= y;
+ }
}
}
*sptr = s;