From 7d0fc1b26a3b42189621723ba5169f2e09d0c5d8 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 25 Jun 2018 06:51:40 -0700 Subject: ftw: fix broken callback mechanism. * ftw.c (max): New macro. (ftw_callback): Allocate enough args for all five arguments. This bug went undetected when this was developed. A more recently added assertion in args.c caught this. --- ftw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ftw.c') diff --git a/ftw.c b/ftw.c index e3e81e4b..22b857e3 100644 --- a/ftw.c +++ b/ftw.c @@ -43,6 +43,8 @@ #include "sysif.h" #include "ftw.h" +#define max(a, b) ((a) > (b) ? (a) : (b)) + static val s_callback; static uw_frame_t *s_exit_point; @@ -66,7 +68,7 @@ static int ftw_callback(const char *c_path, const struct stat *c_sb, val base = num(fb->base); val result; - args_decl(args, ARGS_MIN); + args_decl(args, max(ARGS_MIN, 5)); args_add5(args, path, type, sb, level, base); result = generic_funcall(s_callback, args); c_result = if3(integerp(result), c_num(result), 0); -- cgit v1.2.3