summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-11-01 15:18:22 -0400
committerTavian Barnes <tavianator@tavianator.com>2019-11-01 15:18:22 -0400
commita81c3f1dac2771b77e4d55012bb09a24279fb695 (patch)
treec6aca95cccff002bae6883ee3371a18eeb0b67a3
parentf29632efd87b403fadcecff1d19b0be7bf90af84 (diff)
downloadbfs-a81c3f1dac2771b77e4d55012bb09a24279fb695.tar.xz
bftw: Avoid shadowing a variable
-rw-r--r--bftw.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/bftw.c b/bftw.c
index 2347b00..9804853 100644
--- a/bftw.c
+++ b/bftw.c
@@ -1028,11 +1028,8 @@ static void bftw_init_ftwbuf(struct bftw_state *state, enum bftw_visit visit) {
}
if (ftwbuf->typeflag == BFTW_DIR && (state->flags & BFTW_DETECT_CYCLES)) {
- for (const struct bftw_file *parent = file; parent; parent = parent->parent) {
- if (parent->depth == ftwbuf->depth) {
- continue;
- }
- if (parent->dev == statbuf->dev && parent->ino == statbuf->ino) {
+ for (const struct bftw_file *ancestor = parent; ancestor; ancestor = ancestor->parent) {
+ if (ancestor->dev == statbuf->dev && ancestor->ino == statbuf->ino) {
ftwbuf->typeflag = BFTW_ERROR;
ftwbuf->error = ELOOP;
return;