summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-03-07 11:58:20 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2020-03-07 11:58:48 -0800
commit9f4b260c2b98ea05a02e0ab7213156ce2e60e5a9 (patch)
tree10620a4522a216216922299407460d0e8e3330dd /lib
parent3274b8090bf18dec00b6ce45d6a01bf5263982ed (diff)
downloademacs-9f4b260c2b98ea05a02e0ab7213156ce2e60e5a9.tar.gz
Update from Gnulib
This incorporates: 2020-03-07 open, openat: port to (O_RDWR | O_RDONLY) != 0 * lib/open.c: Copy from Gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/open.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/open.c b/lib/open.c
index 487194f6652..bb180fde292 100644
--- a/lib/open.c
+++ b/lib/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] == '/')