summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-04-15 20:10:26 -0400
committerTavian Barnes <tavianator@tavianator.com>2017-04-15 20:10:26 -0400
commita1f764c5e5041d80300182b41c346d22292068b2 (patch)
tree05429e250ae0a97156c7a28999cf3a50b0f189ea
parent78d52a7c0e1eef84a61bdb847d6aa83b6dcdccb2 (diff)
downloadbfs-a1f764c5e5041d80300182b41c346d22292068b2.tar.xz
exec: close() the working directory even if !ftwbuf
-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;