mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
MFp4: rework tmpfs_readdir() logic in terms of correctness.
Approved by: re (tmpfs blanket) Tested with: fstest, fsx
This commit is contained in:
parent
6ec46f7aa8
commit
1f32d0127b
1 changed files with 16 additions and 13 deletions
|
|
@ -1219,22 +1219,25 @@ tmpfs_readdir(struct vop_readdir_args *v)
|
|||
|
||||
startoff = uio->uio_offset;
|
||||
|
||||
switch (startoff) {
|
||||
case TMPFS_DIRCOOKIE_DOT:
|
||||
if (uio->uio_offset == TMPFS_DIRCOOKIE_DOT) {
|
||||
error = tmpfs_dir_getdotdent(node, uio);
|
||||
if (error == 0)
|
||||
cnt++;
|
||||
break;
|
||||
case TMPFS_DIRCOOKIE_DOTDOT:
|
||||
error = tmpfs_dir_getdotdotdent(node, uio);
|
||||
if (error == 0)
|
||||
cnt++;
|
||||
break;
|
||||
default:
|
||||
error = tmpfs_dir_getdents(node, uio, &cnt);
|
||||
MPASS(error >= -1);
|
||||
if (error != 0)
|
||||
goto outok;
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (uio->uio_offset == TMPFS_DIRCOOKIE_DOTDOT) {
|
||||
error = tmpfs_dir_getdotdotdent(node, uio);
|
||||
if (error != 0)
|
||||
goto outok;
|
||||
cnt++;
|
||||
}
|
||||
|
||||
error = tmpfs_dir_getdents(node, uio, &cnt);
|
||||
|
||||
outok:
|
||||
MPASS(error >= -1);
|
||||
|
||||
if (error == -1)
|
||||
error = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue