summaryrefslogtreecommitdiffstats
path: root/src/bftw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bftw.c')
-rw-r--r--src/bftw.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bftw.c b/src/bftw.c
index 9d85966..f8d0ac5 100644
--- a/src/bftw.c
+++ b/src/bftw.c
@@ -219,7 +219,6 @@ static void bftw_file_close(struct bftw_cache *cache, struct bftw_file *file) {
bfs_assert(file->pincount == 0);
if (file->dir) {
- bfs_assert(file->fd == bfs_dirfd(file->dir));
bfs_closedir(file->dir);
bftw_freedir(cache, file->dir);
file->dir = NULL;
@@ -354,7 +353,9 @@ static void bftw_file_set_dir(struct bftw_cache *cache, struct bftw_file *file,
bfs_assert(!file->dir);
file->dir = dir;
- if (file->fd < 0) {
+ if (file->fd >= 0) {
+ bfs_assert(file->fd == bfs_dirfd(dir));
+ } else {
file->fd = bfs_dirfd(dir);
bftw_cache_add(cache, file);
}