mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 19:08:58 +00:00
Fix the duplicate filenames that are the result of using getdents.
glibc2 defines struct dirent differently than the Linux kernel does. The getdents function therefore needs to read a heuristically defined number of kernel dirents to satisfy the request. In case where too many kernel dirents have been read, the function lseeks on the directory so that a next call will start with the right dirent. The offset used in lseeking is the offset-field in the last dirent passed to the application. This can only mean that the offset-field holds the offset of the next dirent and not the offset of the dirent itself.
This commit is contained in:
parent
dc112b44ed
commit
5a02dbe45a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=52421
@ -540,7 +540,7 @@ again:
|
||||
linux_dirent.doff = (linux_off_t) linuxreclen;
|
||||
linux_dirent.dreclen = (u_short) bdp->d_namlen;
|
||||
} else {
|
||||
linux_dirent.doff = (linux_off_t) off;
|
||||
linux_dirent.doff = (linux_off_t)(off + reclen);
|
||||
linux_dirent.dreclen = (u_short) linuxreclen;
|
||||
}
|
||||
strcpy(linux_dirent.dname, bdp->d_name);
|
||||
|
@ -540,7 +540,7 @@ again:
|
||||
linux_dirent.doff = (linux_off_t) linuxreclen;
|
||||
linux_dirent.dreclen = (u_short) bdp->d_namlen;
|
||||
} else {
|
||||
linux_dirent.doff = (linux_off_t) off;
|
||||
linux_dirent.doff = (linux_off_t)(off + reclen);
|
||||
linux_dirent.dreclen = (u_short) linuxreclen;
|
||||
}
|
||||
strcpy(linux_dirent.dname, bdp->d_name);
|
||||
|
Loading…
Reference in New Issue
Block a user