Skip to content

Commit

Permalink
switch fchmod(2) to fget_light()
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 27, 2012
1 parent 6b48c5b commit d6483b7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,23 +582,21 @@ SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group

SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
{
struct file * file;
int error = -EBADF;
struct dentry * dentry;
struct file *file;
int error = -EBADF, fput_needed;

file = fget(fd);
file = fget_light(fd, &fput_needed);
if (!file)
goto out;

error = mnt_want_write_file(file);
if (error)
goto out_fput;
dentry = file->f_path.dentry;
audit_inode(NULL, dentry);
audit_inode(NULL, file->f_path.dentry);
error = chown_common(&file->f_path, user, group);
mnt_drop_write_file(file);
out_fput:
fput(file);
fput_light(file, fput_needed);
out:
return error;
}
Expand Down

0 comments on commit d6483b7

Please sign in to comment.