diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2022-03-09 08:46:01 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2022-03-09 08:57:56 -0500 |
commit | 050fedea006f8e03f7d9f55fef7d6fee35c622b6 (patch) | |
tree | c61cdbc0501adf94b37e1ab8539a31d71fdb1896 /bftw.c | |
parent | f1294f1b5ea4c8948433f9c154c59d6f48839572 (diff) | |
download | bfs-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.
Diffstat (limited to 'bftw.c')
-rw-r--r-- | bftw.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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; |