summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDenys Vlasenko2021-07-11 12:00:31 +0200
committerDenys Vlasenko2021-07-11 12:00:31 +0200
commit3d57a8490738d9febaa4496eba791e4fbfc91826 (patch)
treeb421de22c2859dd18f34e99905ac38baba4d41d9 /editors
parent49c3ce64f092fd5434fc67056f312bd32f82bae3 (diff)
downloadbusybox-3d57a8490738d9febaa4496eba791e4fbfc91826.zip
busybox-3d57a8490738d9febaa4496eba791e4fbfc91826.tar.gz
awk: undo TI_PRINT, it introduced a bug (print with any redirect acting as printf)
function old new delta evaluate 3329 3337 +8 Patch by Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors')
-rw-r--r--editors/awk.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 755e68f..0aa7c08 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -462,8 +462,7 @@ static const uint32_t tokeninfo[] ALIGN4 = {
0,
0, /* \n */
ST_IF, ST_DO, ST_FOR, OC_BREAK,
-#define TI_PRINT OC_PRINT
- OC_CONTINUE, OC_DELETE|Rx, TI_PRINT,
+ OC_CONTINUE, OC_DELETE|Rx, OC_PRINT,
OC_PRINTF, OC_NEXT, OC_NEXTFILE,
OC_RETURN|Vx, OC_EXIT|Nx,
ST_WHILE,
@@ -2944,7 +2943,10 @@ static var *evaluate(node *op, var *res)
F = rsm->F;
}
- if (opinfo == TI_PRINT) {
+ /* Can't just check 'opinfo == OC_PRINT' here, parser ORs
+ * additional bits to opinfos of print/printf with redirects
+ */
+ if ((opinfo & OPCLSMASK) == OC_PRINT) {
if (!op1) {
fputs(getvar_s(intvar[F0]), F);
} else {