1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-12 15:06:44 +02:00

(fts_children): If fchdir fails, close file descriptor

before returning.  From NetBSD.
This commit is contained in:
Jim Meyering
2003-02-28 11:04:18 +00:00
parent 9fef9aa3eb
commit fb428bedfc

View File

@@ -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);
}