Skip to content

Commit

Permalink
switch ftruncate(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 f6d2ac5 commit bf2965d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,16 @@ SYSCALL_DEFINE2(truncate, const char __user *, path, long, length)

static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
{
struct inode * inode;
struct inode *inode;
struct dentry *dentry;
struct file * file;
int error;
struct file *file;
int error, fput_needed;

error = -EINVAL;
if (length < 0)
goto out;
error = -EBADF;
file = fget(fd);
file = fget_light(fd, &fput_needed);
if (!file)
goto out;

Expand Down Expand Up @@ -172,7 +172,7 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);
sb_end_write(inode->i_sb);
out_putf:
fput(file);
fput_light(file, fput_needed);
out:
return error;
}
Expand Down

0 comments on commit bf2965d

Please sign in to comment.