ecryptfs: fixed testing of file descriptor flags
This patch replaces the check (lower_file->f_flags & O_RDONLY) with ((lower_file & O_ACCMODE) == O_RDONLY). Signed-off-by: Roberto Sassu <roberto.sassu@polito.it> Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
This commit is contained in:
parent
27992890b0
commit
0abe116947
|
@ -199,8 +199,8 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
|
|||
ecryptfs_dentry->d_name.name, rc);
|
||||
goto out_free;
|
||||
}
|
||||
if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY)
|
||||
&& !(file->f_flags & O_RDONLY)) {
|
||||
if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE)
|
||||
== O_RDONLY && (file->f_flags & O_ACCMODE) != O_RDONLY) {
|
||||
rc = -EPERM;
|
||||
printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs "
|
||||
"file must hence be opened RO\n", __func__);
|
||||
|
|
Loading…
Reference in New Issue