CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2026/04/08 05:32:24
Modified files:
sys/kern : vfs_vnops.c
Log message:
error with EINVAL if open(2) is called with both O_CREAT and O_DIRECTORY
Before this change:
If no file or directory matching the last component of a path existed.
A regular file was created, an error was returned and errno set to ENOTDIR.
If a regular file matching the last component of a path existed,
an error was returned and errno set to ENOTDIR.
If a directory matching the last component of a path existed,
it was opened without error.
One possible reading of POSIX is that O_CREAT | O_DIRECTORY is a valid way
to get a file descriptor for an existing directory. In practice it isn't
used and the combination of O_CREAT and O_DIRECTORY has returned an error
on NetBSD since 2010 and Linux since 2023.
ok deraadt@ daniel@