mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Fix getdents syscall.
The offset field in struct dirent was set to the offset of the next dirent in rev 1.36. The offset was calculated from the current offset and the record length. This offset does not necessarily match the real offset when we are using cookies. Therefore, also use the cookies to set the offset field in struct dirent if we're using cookies to iterate through the dirents.
This commit is contained in:
parent
1c25c5e077
commit
edc5a9dd25
1 changed files with 4 additions and 1 deletions
|
|
@ -508,7 +508,10 @@ again:
|
|||
linux_dirent.doff = (linux_off_t) linuxreclen;
|
||||
linux_dirent.dreclen = (u_short) bdp->d_namlen;
|
||||
} else {
|
||||
linux_dirent.doff = (linux_off_t)(off + reclen);
|
||||
if (cookiep)
|
||||
linux_dirent.doff = (linux_off_t)*cookiep;
|
||||
else
|
||||
linux_dirent.doff = (linux_off_t)(off + reclen);
|
||||
linux_dirent.dreclen = (u_short) linuxreclen;
|
||||
}
|
||||
strcpy(linux_dirent.dname, bdp->d_name);
|
||||
|
|
|
|||
Loading…
Reference in a new issue