Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F176992595
D2852.1793708028.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
721 B
Referenced Files
None
Subscribers
None
D2852.1793708028.diff
View Options
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 = (sp->fts_child == NULL) ? errno : 0;
+ rc = fchdir(fd);
+ if (rc < 0 && serrno == 0)
+ serrno = errno;
(void)_close(fd);
+ errno = serrno;
+ if (rc < 0)
+ return (NULL);
return (sp->fts_child);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 3, 12:13 PM (2 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41366963
Default Alt Text
D2852.1793708028.diff (721 B)
Attached To
Mode
D2852: Fix bug 200942 - Don't squash fts_children errors
Attached
Detach File
Event Timeline