diff options
-rw-r--r-- | lib/fts.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -672,8 +672,10 @@ fts_children(sp, instr) if ((fd = open(".", O_RDONLY, 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); } |