Skip to content

Commit

Permalink
bftw: Actually stop if the callback returns BFTW_STOP
Browse files Browse the repository at this point in the history
Otherwise, bftw_ids() or bftw_eds() might keep going!

Fixes: 5f16169 ("bftw: Share the bftw_state between iterations of ids/eds")
  • Loading branch information
tavianator committed Feb 1, 2024
1 parent a726c71 commit 670ebd9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bftw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ static int bftw_impl(struct bftw_state *state) {
break;
}
if (bftw_visit(state, NULL) != 0) {
break;
return -1;
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/bsd/s_quit.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
basic/j/foo
4 changes: 4 additions & 0 deletions tests/bsd/s_quit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Regression test: bfs -S ids -s -name foo -quit would not actually quit,
# ending up in a confused state and erroring/crashing

bfs_diff -s basic -name foo -print -quit

0 comments on commit 670ebd9

Please sign in to comment.