summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/eval.c b/eval.c
index 53eacf8..028b31d 100644
--- a/eval.c
+++ b/eval.c
@@ -1383,8 +1383,6 @@ int eval_cmdline(const struct cmdline *cmdline) {
return EXIT_SUCCESS;
}
- int nopenfd = infer_fdlimit(cmdline);
-
struct callback_args args = {
.cmdline = cmdline,
.ret = EXIT_SUCCESS,
@@ -1397,14 +1395,28 @@ int eval_cmdline(const struct cmdline *cmdline) {
args.seen = &seen;
}
+ struct bftw_args bftw_args = {
+ .callback = cmdline_callback,
+ .ptr = &args,
+ .nopenfd = infer_fdlimit(cmdline),
+ .flags = cmdline->flags,
+ };
+
for (struct root *root = cmdline->roots; root && !args.quit; root = root->next) {
if (cmdline->debug & DEBUG_SEARCH) {
- fprintf(stderr, "bftw(\"%s\", cmdline_callback, %d, ", root->path, nopenfd);
- dump_bftw_flags(cmdline->flags);
- fprintf(stderr, ", &args)\n");
+ fprintf(stderr,
+ "bftw(\"%s\", { "
+ ".callback = cmdline_callback, "
+ ".ptr = &args, "
+ ".nopenfd = %d, "
+ ".flags = ",
+ root->path,
+ bftw_args.nopenfd);
+ dump_bftw_flags(bftw_args.flags);
+ fprintf(stderr, " })\n");
}
- if (bftw(root->path, cmdline_callback, nopenfd, cmdline->flags, &args) != 0) {
+ if (bftw(root->path, &bftw_args) != 0) {
args.ret = EXIT_FAILURE;
perror("bftw()");
}