diff options
author | Jim Meyering <jim@meyering.net> | 2003-02-28 11:04:18 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-02-28 11:04:18 +0000 |
commit | fb428bedfcd04805bd81029f054ac3eb07c8282a (patch) | |
tree | 6225b557b7f3cc4d9e640007d131ccedcc093de8 | |
parent | 9fef9aa3ebb24ad2f1db41ca6d1c71883c93ef87 (diff) | |
download | coreutils-fb428bedfcd04805bd81029f054ac3eb07c8282a.tar.xz |
(fts_children): If fchdir fails, close file descriptor
before returning. From NetBSD.
-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); } |