mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
Switch may_open() and break_lease() to passing O_...
... instead of mixing FMODE_ and O_ Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
d208bbdda9
commit
8737c9305b
8 changed files with 18 additions and 21 deletions
10
fs/namei.c
10
fs/namei.c
|
|
@ -1503,7 +1503,7 @@ int may_open(struct path *path, int acc_mode, int flag)
|
|||
* An append-only file must be opened in append mode for writing.
|
||||
*/
|
||||
if (IS_APPEND(inode)) {
|
||||
if ((flag & FMODE_WRITE) && !(flag & O_APPEND))
|
||||
if ((flag & O_ACCMODE) != O_RDONLY && !(flag & O_APPEND))
|
||||
return -EPERM;
|
||||
if (flag & O_TRUNC)
|
||||
return -EPERM;
|
||||
|
|
@ -1547,7 +1547,7 @@ static int handle_truncate(struct path *path)
|
|||
* what get passed to sys_open().
|
||||
*/
|
||||
static int __open_namei_create(struct nameidata *nd, struct path *path,
|
||||
int flag, int mode)
|
||||
int open_flag, int mode)
|
||||
{
|
||||
int error;
|
||||
struct dentry *dir = nd->path.dentry;
|
||||
|
|
@ -1565,7 +1565,7 @@ out_unlock:
|
|||
if (error)
|
||||
return error;
|
||||
/* Don't check for write permission, don't truncate */
|
||||
return may_open(&nd->path, 0, flag & ~O_TRUNC);
|
||||
return may_open(&nd->path, 0, open_flag & ~O_TRUNC);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1736,7 +1736,7 @@ do_last:
|
|||
error = mnt_want_write(nd.path.mnt);
|
||||
if (error)
|
||||
goto exit_mutex_unlock;
|
||||
error = __open_namei_create(&nd, &path, flag, mode);
|
||||
error = __open_namei_create(&nd, &path, open_flag, mode);
|
||||
if (error) {
|
||||
mnt_drop_write(nd.path.mnt);
|
||||
goto exit;
|
||||
|
|
@ -1798,7 +1798,7 @@ ok:
|
|||
if (error)
|
||||
goto exit;
|
||||
}
|
||||
error = may_open(&nd.path, acc_mode, flag);
|
||||
error = may_open(&nd.path, acc_mode, open_flag);
|
||||
if (error) {
|
||||
if (will_truncate)
|
||||
mnt_drop_write(nd.path.mnt);
|
||||
|
|
|
|||
Loading…
Reference in a new issue