]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
man/man2/open.2: Fix doc for O_CREAT | O_DIRECTORY
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 30 May 2025 07:20:19 +0000 (00:20 -0700)
committerAlejandro Colomar <alx@kernel.org>
Fri, 30 May 2025 12:44:36 +0000 (14:44 +0200)
Although Linux kernels before 5.7 would create a regular file when
opening a nonexistent file with O_CREAT | O_DIRECTORY, this behavior
was changed to something deeply buggy in 5.7, and when the bug was
fixed in 6.4 this combination of open flags became invalid.

Adjust the documentation to match the 6.4+ behavior,
which makes more sense anyway.

Signed-off-by: Paul Eggert <eggert@cs.ucla.edu>
Message-ID: <20250530072029.344532-1-eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
man/man2/open.2

index 948dcd62e39decdf3e39ff19ebaebba1768237d5..c47b2ad58702495f4c41fec7fe1dbda5cebe9d64 100644 (file)
@@ -1068,6 +1068,16 @@ was specified.
 .TP
 .B EINVAL
 .B O_CREAT
+and
+.B O_DIRECTORY
+were both specified in
+.I flags ,
+and the Linux kernel version is 6.4 or later.
+(Earlier kernels were inconsistent in this area,
+and POSIX does not specify the behavior.)
+.TP
+.B EINVAL
+.B O_CREAT
 was specified in
 .I flags
 and the final component ("basename") of the new file's
@@ -1882,20 +1892,6 @@ and
 when trying to determine whether the kernel supports
 .B O_TMPFILE
 functionality.
-.P
-When both
-.B O_CREAT
-and
-.B O_DIRECTORY
-are specified in
-.I flags
-and the file specified by
-.I path
-does not exist,
-.BR open ()
-will create a regular file (i.e.,
-.B O_DIRECTORY
-is ignored).
 .SH SEE ALSO
 .BR chmod (2),
 .BR chown (2),