bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/4] fcntl-h: fix O_ACCMODE on cygwin


From: Eric Blake
Subject: [PATCH 3/4] fcntl-h: fix O_ACCMODE on cygwin
Date: Fri, 8 Apr 2011 11:33:02 -0600

* doc/posix-headers/fcntl.texi (fcntl.h): Document the bug.
* lib/fcntl.in.h (O_ACCMODE): Fix it.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog                    |    4 ++++
 doc/posix-headers/fcntl.texi |    5 +++++
 lib/fcntl.in.h               |    5 +++++
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fe0a886..58f0c53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2011-04-08  Eric Blake  <address@hidden>

+       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.
+
        pipe-filter: drop O_NONBLOCK workarounds
        * modules/pipe-filter-gi (Depends-on): Add fcntl-h.
        * modules/pipe-filter-ii (Depends-on): Likewise.
diff --git a/doc/posix-headers/fcntl.texi b/doc/posix-headers/fcntl.texi
index 29b61ec..c87e872 100644
--- a/doc/posix-headers/fcntl.texi
+++ b/doc/posix-headers/fcntl.texi
@@ -23,6 +23,11 @@ fcntl.h
 Gnulib defines these macros to @samp{O_RDONLY}, which is typically 0.

 @item
+The @samp{O_ACCMODE} mask mistakenly omits @samp{O_SEARCH} and
address@hidden on some platforms:
+Cygwin.
+
address@hidden
 @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.
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index b6521d6..971316f 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -256,6 +256,11 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
 # 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
-- 
1.7.4.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]