From 7fbf673ae2db33d6e47386bf3169d4b48f0fc8b4 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 29 Feb 2020 14:04:34 -0500 Subject: 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. --- parse.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'parse.c') 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; -- cgit v1.2.3