]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
Document O_CREAT|O_DIRECTORY bugs with Linux <6.4
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 30 May 2025 07:41:32 +0000 (00:41 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 30 May 2025 07:42:51 +0000 (00:42 -0700)
doc/posix-functions/open.texi
doc/posix-functions/openat.texi

index 26bb757646d923b6956a1afe6a43773c727cb6c6..723a15a828d276f56a6bef458a0948ef2668064f 100644 (file)
@@ -55,6 +55,14 @@ On some platforms, @code{O_SEARCH} may reject directories
 where you have search access even though @code{O_SEARCH} is not replaced:
 macOS 12.6.
 @item
+When the file does not exist, POSIX says
+the behavior of @code{O_CREAT | O_DIRECTORY} is unspecified.
+Most platforms fail with @code{EINVAL} in this case.
+However, in Linux kernels 6.3 and earlier, this function
+creates a regular file and then either returns successfully
+(Linux kernel 5.6 and earlier) or fails with @code{ENOTDIR}
+(Linux kernels 5.7--6.3).
+@item
 @code{open ("symlink", O_CREAT ...)} fails when the argument points to a
 nonexistent file in an existing directory on some platforms:
 @c https://dev.haiku-os.org/ticket/18355
index 8e39853629218d7583a568d4646ef97c277f5e68..34771eb9903a58fbee1a05fa43afe6c1cea211c3 100644 (file)
@@ -43,6 +43,14 @@ On some platforms, @code{O_SEARCH} may reject directories
 where you have search access even though @code{O_SEARCH} is not replaced:
 macOS 12.6.
 @item
+When the file does not exist, POSIX says
+the behavior of @code{O_CREAT | O_DIRECTORY} is unspecified.
+Most platforms fail with @code{EINVAL} in this case.
+However, in Linux kernels 6.3 and earlier, this function
+creates a regular file and then either returns successfully
+(Linux kernel 5.6 and earlier) or fails with @code{ENOTDIR}
+(Linux kernels 5.7--6.3).
+@item
 @code{openat (fd, "symlink", O_NOFOLLOW ...)} fails with @code{errno}
 set to @code{EMLINK} instead of the POSIX-required @code{ELOOP} on
 some platforms: