Skip to content

Commit

Permalink
allow O_TMPFILE to work with O_WRONLY
Browse files Browse the repository at this point in the history
Change-Id: I90171d1b53a4c35bfa76757ecfdfb6f95330d107
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro authored and elektroschmock committed Dec 10, 2018
1 parent 8854099 commit f4e1b7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,8 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o
if ((flags & O_TMPFILE_MASK) != O_TMPFILE)
return -EINVAL;
acc_mode = MAY_OPEN | ACC_MODE(flags);
if (!(acc_mode & MAY_WRITE))
return -EINVAL;
} else if (flags & O_PATH) {
/*
* If we have O_PATH in the open flag. Then we
Expand Down
4 changes: 2 additions & 2 deletions include/uapi/asm-generic/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
#endif

/* a horrid kludge trying to make sure that this will fail on old kernels */
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY | O_RDWR)
#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT | O_ACCMODE)
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)

#ifndef O_NDELAY
#define O_NDELAY O_NONBLOCK
Expand Down

0 comments on commit f4e1b7e

Please sign in to comment.