diff options
author | marcel <marcel@FreeBSD.org> | 1999-10-21 09:14:49 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 1999-10-21 09:14:49 +0000 |
commit | 90f63b1ea896541115fc71422c41a64cb0068d84 (patch) | |
tree | e5d004be4f7f44d4a7861fe040ea3ce66979529c /sys/compat/linux/linux_file.c | |
parent | f9075340a8ef01b333d169d155a235f7564dbe61 (diff) | |
download | FreeBSD-src-90f63b1ea896541115fc71422c41a64cb0068d84.zip FreeBSD-src-90f63b1ea896541115fc71422c41a64cb0068d84.tar.gz |
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.
Diffstat (limited to 'sys/compat/linux/linux_file.c')
-rw-r--r-- | sys/compat/linux/linux_file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 11ea240..16184ff 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -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); |