diff options
author | 2018-02-15 13:39:15 -0600 | |
---|---|---|
committer | 2018-02-15 13:39:15 -0600 | |
commit | b6a015aa91d7ab84c2f5466f3b5704f501129cbc (patch) | |
tree | a2e5ed8570853b5e49e7c023620e111c1984f489 | |
parent | 23f089f480e04ca1b88df8fe1f46b864fee2a0b8 (diff) | |
download | pseudo-b6a015aa91d7ab84c2f5466f3b5704f501129cbc.tar.gz pseudo-b6a015aa91d7ab84c2f5466f3b5704f501129cbc.tar.bz2 pseudo-b6a015aa91d7ab84c2f5466f3b5704f501129cbc.zip |
Handle O_TMPFILE more better
O_TMPFILE is, on at least one system, (__O_TMPFILE | O_DIRECTORY),
so (flags & O_TMPFILE) can be non-zero even when O_TMPFILE was not set.
Signed-off-by: Seebs <seebs@seebs.net>
-rw-r--r-- | ChangeLog.txt | 5 | ||||
-rw-r--r-- | ports/linux/guts/openat.c | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt index 84c5d5a..a6e4c79 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,8 @@ +2018-02-15: + * (seebs) O_TMPFILE is actually some other flag AND O_DIRECTORYy, + so a test for (flags & O_TMPFILE) does not actually test that + O_TMPFILE is set. + 2018-01-20: * (seebs) merge patch from <joshua.g.lock@linux.intel.com> to fix open/openat flags. diff --git a/ports/linux/guts/openat.c b/ports/linux/guts/openat.c index b571c56..924e354 100644 --- a/ports/linux/guts/openat.c +++ b/ports/linux/guts/openat.c @@ -42,7 +42,7 @@ /* don't handle O_CREAT the same way if O_TMPFILE exists * and is set. */ - if (flags & O_TMPFILE) { + if ((flags & O_TMPFILE) == O_TMPFILE) { existed = 0; } else #endif @@ -80,7 +80,7 @@ * database, because there's no directory entries for * the file yet. */ - if (flags & O_TMPFILE) { + if ((flags & O_TMPFILE) == O_TMPFILE) { real_fchmod(rc, PSEUDO_FS_MODE(mode, 0)); errno = save_errno; return rc; |