From 050fedea006f8e03f7d9f55fef7d6fee35c622b6 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 9 Mar 2022 08:46:01 -0500 Subject: bftw: Fix open FD accounting Due to the introduction of bfs_dir, we don't need to reserve an extra file descriptor for the currently open directory. --- bftw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'bftw.c') diff --git a/bftw.c b/bftw.c index dcf270a..687dc03 100644 --- a/bftw.c +++ b/bftw.c @@ -562,7 +562,7 @@ static int bftw_state_init(struct bftw_state *state, const struct bftw_args *arg state->error = 0; - if (args->nopenfd < 2) { + if (args->nopenfd < 1) { errno = EMFILE; return -1; } @@ -572,8 +572,7 @@ static int bftw_state_init(struct bftw_state *state, const struct bftw_args *arg return -1; } - // Reserve 1 fd for the open bfs_dir - bftw_cache_init(&state->cache, args->nopenfd - 1); + bftw_cache_init(&state->cache, args->nopenfd); bftw_queue_init(&state->queue); state->batch = NULL; -- cgit v1.2.3