aboutsummaryrefslogtreecommitdiff
path: root/gnulib/import/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib/import/open.c')
-rw-r--r--gnulib/import/open.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gnulib/import/open.c b/gnulib/import/open.c
index 487194f..751b42d 100644
--- a/gnulib/import/open.c
+++ b/gnulib/import/open.c
@@ -110,7 +110,9 @@ open (const char *filename, int flags, ...)
directories,
- if O_WRONLY or O_RDWR is specified, open() must fail because the
file does not contain a '.' directory. */
- if (flags & (O_CREAT | O_WRONLY | O_RDWR))
+ if ((flags & O_CREAT)
+ || (flags & O_ACCMODE) == O_RDWR
+ || (flags & O_ACCMODE) == O_WRONLY)
{
size_t len = strlen (filename);
if (len > 0 && filename[len - 1] == '/')
@@ -122,7 +124,7 @@ open (const char *filename, int flags, ...)
#endif
fd = orig_open (filename,
- flags & ~(have_cloexec <= 0 ? O_CLOEXEC : 0), mode);
+ flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode);
if (flags & O_CLOEXEC)
{