git://git.exim.org
/
users
/
jgh
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Also ${eval:x % 0} fixed to not SIGFPE.
[users/jgh/exim.git]
/
src
/
src
/
expand.c
diff --git
a/src/src/expand.c
b/src/src/expand.c
index 06e0eb0ced0d6dd09124c67242aabe00699cb88b..fece8c150b4fc8e2e938106b150f24a3d9f42226 100644
(file)
--- 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;
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;
}
}
*sptr = s;