Page MenuHomeFreeBSD

D2852.id6278.diff
No OneTemporary

D2852.id6278.diff

Index: lib/libc/gen/fts.c
===================================================================
--- lib/libc/gen/fts.c
+++ lib/libc/gen/fts.c
@@ -515,7 +515,7 @@
fts_children(FTS *sp, int instr)
{
FTSENT *p;
- int fd;
+ int fd, rc, serrno;
if (instr != 0 && instr != FTS_NAMEONLY) {
errno = EINVAL;
@@ -571,11 +571,14 @@
if ((fd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0)
return (NULL);
sp->fts_child = fts_build(sp, instr);
- if (fchdir(fd)) {
- (void)_close(fd);
- return (NULL);
- }
+ serrno = errno;
+ rc = fchdir(fd);
+ if (serrno == 0)
+ serrno = errno;
(void)_close(fd);
+ errno = serrno;
+ if (rc < 0)
+ return (NULL);
return (sp->fts_child);
}

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 19, 5:14 AM (1 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27732060
Default Alt Text
D2852.id6278.diff (681 B)

Event Timeline