]> Pileus Git - ~andy/linux/blobdiff - arch/parisc/hpux/fs.c
Merge tag 'for-3.7-rc1' of git://gitorious.org/linux-pwm/linux-pwm
[~andy/linux] / arch / parisc / hpux / fs.c
index c71eb6c7989707d0fbbc609a8e27ec5261204b25..6785de7bd2a0298c58f025bda474b037e3ea07f9 100644 (file)
@@ -109,33 +109,32 @@ Efault:
 
 int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count)
 {
-       struct file * file;
+       struct fd arg;
        struct hpux_dirent __user * lastdirent;
        struct getdents_callback buf;
-       int error = -EBADF;
+       int error;
 
-       file = fget(fd);
-       if (!file)
-               goto out;
+       arg = fdget(fd);
+       if (!arg.file)
+               return -EBADF;
 
        buf.current_dir = dirent;
        buf.previous = NULL;
        buf.count = count;
        buf.error = 0;
 
-       error = vfs_readdir(file, filldir, &buf);
+       error = vfs_readdir(arg.file, filldir, &buf);
        if (error >= 0)
                error = buf.error;
        lastdirent = buf.previous;
        if (lastdirent) {
-               if (put_user(file->f_pos, &lastdirent->d_off))
+               if (put_user(arg.file->f_pos, &lastdirent->d_off))
                        error = -EFAULT;
                else
                        error = count - buf.count;
        }
 
-       fput(file);
-out:
+       fdput(arg);
        return error;
 }