diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2016-02-22 13:51:11 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2016-02-22 13:53:15 -0500 |
commit | 59f46665aa10eed0776e93dc5f67368a3b8b27e3 (patch) | |
tree | b216beacfeb02814a67511aab720656f4fa0a764 /bftw.c | |
parent | a1aca80e0dc5cf0fcb7b467dd469c639353f19d6 (diff) | |
download | bfs-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.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; |