---
 doc/posix-functions/open.texi   | 8 ++++++++
 doc/posix-functions/openat.texi | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/doc/posix-functions/open.texi b/doc/posix-functions/open.texi
index 26bb757646..723a15a828 100644
--- a/doc/posix-functions/open.texi
+++ b/doc/posix-functions/open.texi
@@ -55,6 +55,14 @@ open
 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
diff --git a/doc/posix-functions/openat.texi b/doc/posix-functions/openat.texi
index 8e39853629..34771eb990 100644
--- a/doc/posix-functions/openat.texi
+++ b/doc/posix-functions/openat.texi
@@ -43,6 +43,14 @@ openat
 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:
-- 
2.49.0


Reply via email to