HomeFreeBSD

readdir: Fix error check.

Description

readdir: Fix error check.

Now that dd_size is unsigned, we need to check if the return value from
getdirentries() was negative before assigning it to dd_size.

While here, simplify the scandir_error test case slightly, and verify
that calling readdir() again after EOF still returns NULL.

Fixes: 42e613018da5
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D51266

Details

Provenance
desAuthored on Jul 11 2025, 8:43 PM
Reviewer
kevans
Differential Revision
D51266: readdir: Fix error check.
Parents
rG5652050565f7: gstat.8: Add an example of how to filter the results
Branches
Unknown
Tags
Unknown