HomeFreeBSD

libc: Improve POSIX conformance of dirfd()

Description

libc: Improve POSIX conformance of dirfd()

POSIX states that dirfd() should set errno to EINVAL and return -1 if
dirp does not refer to a valid directory stream. Our interpretation is
that this applies if dirp is null or the file descriptor associated
with it is negative.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D55025

Details

Provenance
desAuthored on Feb 2 2026, 3:46 PM
Reviewer
markj
Differential Revision
D55025: libc: Improve POSIX conformance of dirfd()
Parents
rG387ae6390534: libc: Clean up *dir() code
Branches
Unknown
Tags
Unknown