diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-04-11 22:06:42 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-06-12 14:39:34 -0400 |
commit | 0c10a1e984bc2bed1fe3a7dadbd94a9c24139a91 (patch) | |
tree | 43073ba63fc54b0b30e587aaf71c9e66b721c888 /src/bftw.c | |
parent | e8df57b5a49a70e2daa5bb6c00b8e0e06c51306a (diff) | |
download | bfs-0c10a1e984bc2bed1fe3a7dadbd94a9c24139a91.tar.xz |
dir: Add a flag to bfs_freedir() to force the fd to stay the same
Diffstat (limited to 'src/bftw.c')
-rw-r--r-- | src/bftw.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -853,13 +853,13 @@ static int bftw_gc(struct bftw_state *state, enum bftw_gc_flags flags) { if (file->refcount > 1) { // Keep the fd around if any subdirectories exist - file->fd = bfs_freedir(state->dir); + file->fd = bfs_freedir(state->dir, false); } else { - bfs_closedir(state->dir); file->fd = -1; } if (file->fd < 0) { + bfs_closedir(state->dir); bftw_cache_remove(&state->cache, file); } } |