summaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenys Vlasenko2010-09-15 13:33:02 +0200
committerDenys Vlasenko2010-09-15 13:33:02 +0200
commit063847d6bd23e184c409f37645ba90fa4d039ada (patch)
tree63e360e3e0a2f46d187ef2e21487753a52697efa /shell/ash.c
parent197a6b3c14a8be7101903118516e0e16ec843eb5 (diff)
downloadbusybox-063847d6bd23e184c409f37645ba90fa4d039ada.zip
busybox-063847d6bd23e184c409f37645ba90fa4d039ada.tar.gz
shell/math: return string error indicator, not integer
function old new delta expand_and_evaluate_arith 87 106 +19 expand_one_var 1563 1570 +7 arith 12 18 +6 evaluate_string 678 680 +2 arith_apply 1269 1271 +2 builtin_umask 133 132 -1 ash_arith 118 75 -43 expand_vars_to_list 1094 1038 -56 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/3 up/down: 36/-100) Total: -64 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/shell/ash.c b/shell/ash.c
index c27ab7d..ec887e0 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -5451,15 +5451,8 @@ ash_arith(const char *s)
INT_OFF;
result = arith(&math_state, s);
- if (math_state.errcode < 0) {
- if (math_state.errcode == -3)
- ash_msg_and_raise_error("exponent less than 0");
- if (math_state.errcode == -2)
- ash_msg_and_raise_error("divide by zero");
- if (math_state.errcode == -5)
- ash_msg_and_raise_error("expression recursion loop detected");
- raise_error_syntax(s);
- }
+ if (math_state.errmsg)
+ ash_msg_and_raise_error(math_state.errmsg);
INT_ON;
return result;