HomeFreeBSD

getdirentries: Return ENOTDIR if not a directory.

Description

getdirentries: Return ENOTDIR if not a directory.

This is both more logical and more useful than EINVAL.

While here, also check for VBAD and return EBADF in that case. This can
happen if the underlying filesystem got forcibly unmounted after the
directory was opened. Previously, this would also have returned EINVAL,
which wasn't right but wasn't wrong either; however, ENOTDIR would not
be appropriate.

MFC after: never
Sponsored by: Klara, Inc.
Reviewed by: kevans, kib
Differential Revision: https://reviews.freebsd.org/D51209

Details

Provenance
desAuthored on Jul 9 2025, 8:34 PM
Reviewer
kevans
Differential Revision
D51209: getdirentries: Return ENOTDIR if not a directory.
Parents
rG9bf14f2a475e: kyua: Try harder to delete directories.
Branches
Unknown
Tags
Unknown