aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-30 01:15:04 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-30 01:15:04 +0100
commit1284774d60ebce68dec6fcaf44a33e928c4c1f82 (patch)
tree165bc1ec980eca2d30b04d7939bafbf7667fc1b8 /editors
parentcdeda16ee4acb78569598e848a491ad595af3abb (diff)
downloadbusybox-1284774d60ebce68dec6fcaf44a33e928c4c1f82.tar.gz
awk: fix an incorrect casting to string (bug 725). -44 bytes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors')
-rw-r--r--editors/awk.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/editors/awk.c b/editors/awk.c
index e987bc868..bc8b0dad1 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -2424,17 +2424,19 @@ static var *evaluate(node *op, var *res)
X.re = as_regex(op1, &sreg);
R.i = regexec(X.re, L.s, 0, NULL, 0);
if (X.re == &sreg) regfree(X.re);
- setvar_i(res, (R.i == 0 ? 1 : 0) ^ (opn == '!' ? 1 : 0));
+ setvar_i(res, (R.i == 0) ^ (opn == '!'));
break;
case XC( OC_MOVE ):
/* if source is a temporary string, jusk relink it to dest */
- if (R.v == v1+1 && R.v->string) {
- res = setvar_p(L.v, R.v->string);
- R.v->string = NULL;
- } else {
+//Disabled: if R.v is numeric but happens to have cached R.v->string,
+//then L.v ends up being a string, which is wrong
+// if (R.v == v1+1 && R.v->string) {
+// res = setvar_p(L.v, R.v->string);
+// R.v->string = NULL;
+// } else {
res = copyvar(L.v, R.v);
- }
+// }
break;
case XC( OC_TERNARY ):