* doc/posix-headers/fcntl.texi (fcntl.h): Document the bug.
* lib/fcntl.in.h (O_ACCMODE): Fix it.
Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit
b277764ab1e0a68b1db0bf254ea4dbe8e16c0603)
+2011-04-08 Eric Blake <eblake@redhat.com>
+
+ fcntl-h: fix O_ACCMODE on cygwin
+ * doc/posix-headers/fcntl.texi (fcntl.h): Document the bug.
+ * lib/fcntl.in.h (O_ACCMODE): Fix it.
+
2011-04-06 Eric Blake <eblake@redhat.com>
binary-io: relicense under LGPLv2+
Gnulib defines these macros to @samp{O_RDONLY}, which is typically 0.
@item
+The @samp{O_ACCMODE} mask mistakenly omits @samp{O_SEARCH} and
+@samp{O_EXEC} on some platforms:
+Cygwin.
+
+@item
@samp{O_BINARY}, @samp{O_TEXT} (not specified by POSIX, but essential for
portability to Woe32 platforms) are defined on some platforms but not on
others.
# define O_TTY_INIT 0
#endif
+#if O_ACCMODE != (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
+# undef O_ACCMODE
+# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
+#endif
+
/* For systems that distinguish between text and binary I/O.
O_BINARY is usually declared in fcntl.h */
#if !defined O_BINARY && defined _O_BINARY