summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bftw.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bftw.c b/bftw.c
index cbc9a1b..0cf5c49 100644
--- a/bftw.c
+++ b/bftw.c
@@ -841,7 +841,10 @@ static int bftw_handle_path(struct bftw_state *state) {
return BFTW_FAIL;
}
- enum bftw_action action = state->fn(&state->ftwbuf, state->ptr);
+ // Defensive copy
+ struct BFTW ftwbuf = state->ftwbuf;
+
+ enum bftw_action action = state->fn(&ftwbuf, state->ptr);
switch (action) {
case BFTW_CONTINUE:
case BFTW_SKIP_SIBLINGS: