Skip to content

Commit

Permalink
switch fchmod() to fdget
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Sep 4, 2013
1 parent 7e3fb58 commit 173c840
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,14 +485,13 @@ static int chmod_common(struct path *path, umode_t mode)

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;
}
Expand Down

0 comments on commit 173c840

Please sign in to comment.