Skip to content

Commit 670ebd9

Browse files
committed
bftw: Actually stop if the callback returns BFTW_STOP
Otherwise, bftw_ids() or bftw_eds() might keep going! Fixes: 5f16169 ("bftw: Share the bftw_state between iterations of ids/eds")
1 parent a726c71 commit 670ebd9

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/bftw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@ static int bftw_impl(struct bftw_state *state) {
17911791
break;
17921792
}
17931793
if (bftw_visit(state, NULL) != 0) {
1794-
break;
1794+
return -1;
17951795
}
17961796
}
17971797

tests/bsd/s_quit.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
basic/j/foo

tests/bsd/s_quit.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Regression test: bfs -S ids -s -name foo -quit would not actually quit,
2+
# ending up in a confused state and erroring/crashing
3+
4+
bfs_diff -s basic -name foo -print -quit

0 commit comments

Comments
 (0)