Page MenuHomeFreeBSD

devfs readdir: handle short buffer same as UFS
ClosedPublic

Authored by kib on Fri, Aug 1, 12:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Aug 20, 10:08 AM
Unknown Object (File)
Thu, Aug 14, 2:14 AM
Unknown Object (File)
Fri, Aug 8, 5:51 PM
Unknown Object (File)
Tue, Aug 5, 11:02 PM
Unknown Object (File)
Tue, Aug 5, 10:59 PM
Unknown Object (File)
Tue, Aug 5, 10:55 PM
Unknown Object (File)
Tue, Aug 5, 10:54 PM
Unknown Object (File)
Tue, Aug 5, 10:47 PM
Subscribers

Details

Summary
Return EINVAL if this is the first dirent encountered with the short
buffer, or EJUSTRETURN if something was already copied out.

This is needed to pass eof check in vop_readdir_post(): we are not at
eof but resid was not advanced.

Reported and tested by:    pho

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Fri, Aug 1, 12:31 PM
sys/fs/devfs/devfs_vnops.c
1503

Why not just return 0 in this case? At least one dirent was successfully copied.

Simply stop if buffer is too small and something was copied out.

kib marked an inline comment as done.Fri, Aug 1, 4:40 PM
This revision is now accepted and ready to land.Fri, Aug 1, 4:45 PM
This revision was automatically updated to reflect the committed changes.