diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2019-11-01 15:18:22 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2019-11-01 15:18:22 -0400 |
commit | a81c3f1dac2771b77e4d55012bb09a24279fb695 (patch) | |
tree | c6aca95cccff002bae6883ee3371a18eeb0b67a3 | |
parent | f29632efd87b403fadcecff1d19b0be7bf90af84 (diff) | |
download | bfs-a81c3f1dac2771b77e4d55012bb09a24279fb695.tar.xz |
bftw: Avoid shadowing a variable
-rw-r--r-- | bftw.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -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; |