summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-08-24 10:15:11 -0400
committerTavian Barnes <tavianator@tavianator.com>2016-08-24 11:10:59 -0400
commitac2f808a1bda94f79c2e6553ef44077e39124d25 (patch)
tree655ab5ef749c936f71c81af4b6acc343f5d65d96
parent8395589d15961cedc136a0cf945bd5ae93b5c7c6 (diff)
downloadbfs-ac2f808a1bda94f79c2e6553ef44077e39124d25.tar.xz
bftw: Initialize typeflag to BFTW_UNKNOWN.
It was totally broken on filesystems that spit out DT_UNKNOWN.
-rw-r--r--bftw.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/bftw.c b/bftw.c
index 60bc145..13f073d 100644
--- a/bftw.c
+++ b/bftw.c
@@ -688,12 +688,11 @@ static void bftw_init_buffers(struct bftw_state *state, const struct dirent *de)
ftwbuf->depth = 0;
}
+ ftwbuf->typeflag = BFTW_UNKNOWN;
if (de) {
ftwbuf_use_dirent(ftwbuf, de);
} else if (state->status != BFTW_CHILD) {
ftwbuf->typeflag = BFTW_DIR;
- } else {
- ftwbuf->typeflag = BFTW_UNKNOWN;
}
bool follow = state->flags & (current ? BFTW_FOLLOW_NONROOT : BFTW_FOLLOW_ROOT);