summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bftw.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bftw.c b/bftw.c
index 8c8d8b4..bab357d 100644
--- a/bftw.c
+++ b/bftw.c
@@ -725,9 +725,12 @@ static void bftw_init_buffers(struct bftw_state *state, const struct dirent *de)
if (state->status == BFTW_CHILD) {
ftwbuf->nameoff += current->namelen;
++ftwbuf->depth;
- }
- dircache_entry_base(&state->cache, current, &ftwbuf->at_fd, &ftwbuf->at_path);
+ ftwbuf->at_fd = current->fd;
+ ftwbuf->at_path += ftwbuf->nameoff;
+ } else {
+ dircache_entry_base(&state->cache, current, &ftwbuf->at_fd, &ftwbuf->at_path);
+ }
} else {
ftwbuf->nameoff = basename_offset(ftwbuf->path);
ftwbuf->depth = 0;