Skip to contentSkip to conversation

ecryptfs: fixed testing of file descriptor flags

PATCH In review Roberto Sassu 1 participant 1 message Nov 3, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/5 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).

---
 fs/ecryptfs/file.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/ecryptfs/file.c +2 -2
index 5cfcc3c..26bd93d 100644
@@ -200,8 +200,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__);
Signature · 1 line
1.7.2.3