diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-07-19 19:11:32 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-07-19 19:11:32 -0400 |
commit | ba57ea64cb1820deb37637de0fdb107f0dc90089 (patch) | |
tree | dd8d302d4f16107e87b555aca3630ada6fcd472a | |
parent | c0d15cc7ee8c0d1970197d9eb1727503bcdd2471 (diff) |
allow O_TMPFILE to work with O_WRONLY
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/open.c | 2 | ||||
-rw-r--r-- | include/uapi/asm-generic/fcntl.h | 4 |
2 files changed, 4 insertions, 2 deletions
@@ -844,6 +844,8 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o | |||
844 | if ((flags & O_TMPFILE_MASK) != O_TMPFILE) | 844 | if ((flags & O_TMPFILE_MASK) != O_TMPFILE) |
845 | return -EINVAL; | 845 | return -EINVAL; |
846 | acc_mode = MAY_OPEN | ACC_MODE(flags); | 846 | acc_mode = MAY_OPEN | ACC_MODE(flags); |
847 | if (!(acc_mode & MAY_WRITE)) | ||
848 | return -EINVAL; | ||
847 | } else if (flags & O_PATH) { | 849 | } else if (flags & O_PATH) { |
848 | /* | 850 | /* |
849 | * If we have O_PATH in the open flag. Then we | 851 | * If we have O_PATH in the open flag. Then we |
diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h index 05ac354e124d..95e46c8e05f9 100644 --- a/include/uapi/asm-generic/fcntl.h +++ b/include/uapi/asm-generic/fcntl.h | |||
@@ -89,8 +89,8 @@ | |||
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | /* a horrid kludge trying to make sure that this will fail on old kernels */ | 91 | /* a horrid kludge trying to make sure that this will fail on old kernels */ |
92 | #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY | O_RDWR) | 92 | #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) |
93 | #define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT | O_ACCMODE) | 93 | #define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT) |
94 | 94 | ||
95 | #ifndef O_NDELAY | 95 | #ifndef O_NDELAY |
96 | #define O_NDELAY O_NONBLOCK | 96 | #define O_NDELAY O_NONBLOCK |