[git commit] awk: replace incorrect use of union in undefined function check (no code changes)

Denys Vlasenko vda.linux at googlemail.com
Wed Jun 30 10:12:20 UTC 2021


commit: https://git.busybox.net/busybox/commit/?id=86fc2872b33224cfa5442700c2a8abd020cbf900
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

...which reveals that it's buggy: it thinks "func f(){}" is an undefined function!

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 editors/awk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/editors/awk.c b/editors/awk.c
index 35c11ec58..1115085da 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -2912,7 +2912,7 @@ static var *evaluate(node *op, var *res)
 
 			debug_printf_eval("FUNC\n");
 
-			if (!op->r.n->info && !op->r.f->body.first)
+			if (op->r.f->nargs == 0 && !op->r.f->body.first)
 				syntax_error(EMSG_UNDEF_FUNC);
 
 			/* The body might be empty, still has to eval the args */


More information about the busybox-cvs mailing list