summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-02-29 14:04:34 -0500
committerTavian Barnes <tavianator@tavianator.com>2020-02-29 14:04:34 -0500
commit7fbf673ae2db33d6e47386bf3169d4b48f0fc8b4 (patch)
treea0a7748bc436973d372e64aff96ab876517d2b4a
parente604972ffed159ffeb9f948615540ad8f5b4a4a0 (diff)
downloadbfs-7fbf673ae2db33d6e47386bf3169d4b48f0fc8b4.tar.xz
parse: Give -ls and -fls an ephemeral FD for getpwuid()/getgrgid()
Similar to 9009456c, those functions may open /etc/{passwd,group}, so they need an FD available. Right now, -ls on large trees eventually starts printing numeric IDs instead of usernames/group names.
-rw-r--r--parse.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index 55a903c..1de065b 100644
--- a/parse.c
+++ b/parse.c
@@ -1299,6 +1299,7 @@ static struct expr *parse_fls(struct parser_state *state, int arg1, int arg2) {
if (expr) {
expr_set_always_true(expr);
expr->cost = PRINT_COST;
+ expr->ephemeral_fds = 1;
if (expr_open(state, expr, expr->sdata) != 0) {
goto fail;
}
@@ -1544,6 +1545,7 @@ static struct expr *parse_ls(struct parser_state *state, int arg1, int arg2) {
struct expr *expr = parse_nullary_action(state, eval_fls);
if (expr) {
init_print_expr(state, expr);
+ expr->ephemeral_fds = 1;
expr->reftime = state->now;
}
return expr;