How about O_CREAT_DIRECTORY?
How about O_CREAT_DIRECTORY?
Posted Jul 30, 2026 21:15 UTC (Thu) by alx.manpages (subscriber, #145117)In reply to: How about O_CREAT_DIRECTORY? by alx.manpages
Parent article: Reconsidering O_CREAT|O_DIRECTORY
> Falcato did some research on what other systems do in response to that combination of flags. NetBSD, it seems, will simply fail an open() call in that situation, returning EINVAL. FreeBSD, instead, will allow the call to succeed if the path exists and is a directory; otherwise it will fail. He also noted that all of the behaviors seen — Linux pre- and post-5.7, NetBSD, and FreeBSD — are allowed by POSIX: ""I would not call the old Linux behavior a *bug*, just really odd semantics"".
(And unrelated, but as a comment to the last sentence from Falcato above):
FWIW, "really odd semantics" are a bug, IMO. A bug that conforms to POSIX is still a bug.
