diff options
Diffstat (limited to 'bftw.c')
-rw-r--r-- | bftw.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -234,7 +234,11 @@ static DIR *opendirat(int fd, const char *name) { return NULL; } - return fdopendir(dfd); + DIR *dir = fdopendir(dfd); + if (!dir) { + close(dfd); + } + return dir; } /** |