summaryrefslogtreecommitdiffstats
path: root/bftw.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-02-22 13:51:11 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-02-22 13:53:15 -0500
commit59f46665aa10eed0776e93dc5f67368a3b8b27e3 (patch)
treeb216beacfeb02814a67511aab720656f4fa0a764 /bftw.c
parenta1aca80e0dc5cf0fcb7b467dd469c639353f19d6 (diff)
downloadbfs-59f46665aa10eed0776e93dc5f67368a3b8b27e3.tar.xz
bftw: Use the currently open directory as at_fd in BFTW_CHILD mode.
Diffstat (limited to 'bftw.c')
-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;