Skip to content

Commit

Permalink
ecryptfs: fixed testing of file descriptor flags
Browse files Browse the repository at this point in the history
This patch replaces the check (lower_file->f_flags & O_RDONLY) with
((lower_file & O_ACCMODE) == O_RDONLY).

Signed-off-by: Roberto Sassu <[email protected]>
Signed-off-by: Tyler Hicks <[email protected]>
  • Loading branch information
Roberto Sassu authored and Tyler Hicks committed Jan 17, 2011
1 parent 2799289 commit 0abe116
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/ecryptfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down

0 comments on commit 0abe116

Please sign in to comment.