summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-03-09 08:46:01 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-03-09 08:57:56 -0500
commit050fedea006f8e03f7d9f55fef7d6fee35c622b6 (patch)
treec61cdbc0501adf94b37e1ab8539a31d71fdb1896
parentf1294f1b5ea4c8948433f9c154c59d6f48839572 (diff)
downloadbfs-050fedea006f8e03f7d9f55fef7d6fee35c622b6.tar.xz
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.
-rw-r--r--bftw.c5
1 files changed, 2 insertions, 3 deletions
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;