summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--exec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/exec.c b/exec.c
index ddc52ad..2e1acf3 100644
--- a/exec.c
+++ b/exec.c
@@ -247,7 +247,7 @@ static int bfs_exec_closewd(struct bfs_exec *execbuf, const struct BFTW *ftwbuf)
int ret = 0;
if (execbuf->wd_fd >= 0) {
- if (ftwbuf && execbuf->wd_fd != ftwbuf->at_fd) {
+ if (!ftwbuf || execbuf->wd_fd != ftwbuf->at_fd) {
ret = close(execbuf->wd_fd);
}
execbuf->wd_fd = -1;