diff options
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/fts-compat.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/gen/fts-compat.c b/lib/libc/gen/fts-compat.c index cf1daef..c34a281 100644 --- a/lib/libc/gen/fts-compat.c +++ b/lib/libc/gen/fts-compat.c @@ -573,8 +573,10 @@ __fts_children_44bsd(FTS *sp, int instr) if ((fd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) return (NULL); sp->fts_child = fts_build(sp, instr); - if (fchdir(fd)) + if (fchdir(fd)) { + (void)_close(fd); return (NULL); + } (void)_close(fd); return (sp->fts_child); } |