summaryrefslogtreecommitdiffstats
path: root/bftw.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-02-23 10:09:42 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-02-23 10:09:42 -0500
commit55e2963668d7f2b4150e29c9b57652e3478eab75 (patch)
tree909151a42451d67c72b68c86381951df0d6a4b62 /bftw.c
parent626b1fd062faa08cbdf47f2ae0a2447ce248dda9 (diff)
downloadbfs-55e2963668d7f2b4150e29c9b57652e3478eab75.tar.xz
bftw: Update at_flags when not following a broken symbolic link.
Diffstat (limited to 'bftw.c')
-rw-r--r--bftw.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bftw.c b/bftw.c
index d216481..b4a2e99 100644
--- a/bftw.c
+++ b/bftw.c
@@ -763,7 +763,8 @@ static void bftw_init_buffers(struct bftw_state *state, const struct dirent *de)
int ret = ftwbuf_stat(ftwbuf, &state->statbuf, ftwbuf->at_flags);
if (ret != 0 && follow && errno == ENOENT) {
// Could be a broken symlink, retry without following
- ret = ftwbuf_stat(ftwbuf, &state->statbuf, AT_SYMLINK_NOFOLLOW);
+ ftwbuf->at_flags = AT_SYMLINK_NOFOLLOW;
+ ret = ftwbuf_stat(ftwbuf, &state->statbuf, ftwbuf->at_flags);
}
if (ret != 0) {