summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-08-30 18:48:53 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2013-09-04 05:04:45 +0200
commit173c84012a594a9ee18b63673ab760482c37ad78 (patch)
tree67f1e0e7dfef6030701cb3a3b6f751ab07e41ff0
parentswitch epoll_ctl() to fdget (diff)
downloadlinux-173c84012a594a9ee18b63673ab760482c37ad78.tar.xz
linux-173c84012a594a9ee18b63673ab760482c37ad78.zip
switch fchmod() to fdget
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/open.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/open.c b/fs/open.c
index 7931f76acc2b..8070825b285b 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -485,14 +485,13 @@ out_unlock:
SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode)
{
- struct file * file;
+ struct fd f = fdget(fd);
int err = -EBADF;
- file = fget(fd);
- if (file) {
- audit_inode(NULL, file->f_path.dentry, 0);
- err = chmod_common(&file->f_path, mode);
- fput(file);
+ if (f.file) {
+ audit_inode(NULL, f.file->f_path.dentry, 0);
+ err = chmod_common(&f.file->f_path, mode);
+ fdput(f);
}
return err;
}