aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-12-24 06:47:55 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2010-03-03 13:00:21 -0500
commit8737c9305bd5602b11f7eb4655d5695d4a42a0c6 (patch)
tree54038cac1135b039a292151ebe9b156f80904843 /fs/namei.c
parentd208bbdda991b8808d9c033ce4d31cb1bd87dcfc (diff)
Switch may_open() and break_lease() to passing O_...
... instead of mixing FMODE_ and O_ Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/namei.c b/fs/namei.c
index a4855af776a8..b20f83d1e065 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1503,7 +1503,7 @@ int may_open(struct path *path, int acc_mode, int flag)
1503 * An append-only file must be opened in append mode for writing. 1503 * An append-only file must be opened in append mode for writing.
1504 */ 1504 */
1505 if (IS_APPEND(inode)) { 1505 if (IS_APPEND(inode)) {
1506 if ((flag & FMODE_WRITE) && !(flag & O_APPEND)) 1506 if ((flag & O_ACCMODE) != O_RDONLY && !(flag & O_APPEND))
1507 return -EPERM; 1507 return -EPERM;
1508 if (flag & O_TRUNC) 1508 if (flag & O_TRUNC)
1509 return -EPERM; 1509 return -EPERM;
@@ -1547,7 +1547,7 @@ static int handle_truncate(struct path *path)
1547 * what get passed to sys_open(). 1547 * what get passed to sys_open().
1548 */ 1548 */
1549static int __open_namei_create(struct nameidata *nd, struct path *path, 1549static int __open_namei_create(struct nameidata *nd, struct path *path,
1550 int flag, int mode) 1550 int open_flag, int mode)
1551{ 1551{
1552 int error; 1552 int error;
1553 struct dentry *dir = nd->path.dentry; 1553 struct dentry *dir = nd->path.dentry;
@@ -1565,7 +1565,7 @@ out_unlock:
1565 if (error) 1565 if (error)
1566 return error; 1566 return error;
1567 /* Don't check for write permission, don't truncate */ 1567 /* Don't check for write permission, don't truncate */
1568 return may_open(&nd->path, 0, flag & ~O_TRUNC); 1568 return may_open(&nd->path, 0, open_flag & ~O_TRUNC);
1569} 1569}
1570 1570
1571/* 1571/*
@@ -1736,7 +1736,7 @@ do_last:
1736 error = mnt_want_write(nd.path.mnt); 1736 error = mnt_want_write(nd.path.mnt);
1737 if (error) 1737 if (error)
1738 goto exit_mutex_unlock; 1738 goto exit_mutex_unlock;
1739 error = __open_namei_create(&nd, &path, flag, mode); 1739 error = __open_namei_create(&nd, &path, open_flag, mode);
1740 if (error) { 1740 if (error) {
1741 mnt_drop_write(nd.path.mnt); 1741 mnt_drop_write(nd.path.mnt);
1742 goto exit; 1742 goto exit;
@@ -1798,7 +1798,7 @@ ok:
1798 if (error) 1798 if (error)
1799 goto exit; 1799 goto exit;
1800 } 1800 }
1801 error = may_open(&nd.path, acc_mode, flag); 1801 error = may_open(&nd.path, acc_mode, open_flag);
1802 if (error) { 1802 if (error) {
1803 if (will_truncate) 1803 if (will_truncate)
1804 mnt_drop_write(nd.path.mnt); 1804 mnt_drop_write(nd.path.mnt);