diff options
Diffstat (limited to 'arch/parisc/hpux/fs.c')
-rw-r--r-- | arch/parisc/hpux/fs.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c index c71eb6c79897..6785de7bd2a0 100644 --- a/arch/parisc/hpux/fs.c +++ b/arch/parisc/hpux/fs.c | |||
@@ -109,33 +109,32 @@ Efault: | |||
109 | 109 | ||
110 | int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count) | 110 | int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count) |
111 | { | 111 | { |
112 | struct file * file; | 112 | struct fd arg; |
113 | struct hpux_dirent __user * lastdirent; | 113 | struct hpux_dirent __user * lastdirent; |
114 | struct getdents_callback buf; | 114 | struct getdents_callback buf; |
115 | int error = -EBADF; | 115 | int error; |
116 | 116 | ||
117 | file = fget(fd); | 117 | arg = fdget(fd); |
118 | if (!file) | 118 | if (!arg.file) |
119 | goto out; | 119 | return -EBADF; |
120 | 120 | ||
121 | buf.current_dir = dirent; | 121 | buf.current_dir = dirent; |
122 | buf.previous = NULL; | 122 | buf.previous = NULL; |
123 | buf.count = count; | 123 | buf.count = count; |
124 | buf.error = 0; | 124 | buf.error = 0; |
125 | 125 | ||
126 | error = vfs_readdir(file, filldir, &buf); | 126 | error = vfs_readdir(arg.file, filldir, &buf); |
127 | if (error >= 0) | 127 | if (error >= 0) |
128 | error = buf.error; | 128 | error = buf.error; |
129 | lastdirent = buf.previous; | 129 | lastdirent = buf.previous; |
130 | if (lastdirent) { | 130 | if (lastdirent) { |
131 | if (put_user(file->f_pos, &lastdirent->d_off)) | 131 | if (put_user(arg.file->f_pos, &lastdirent->d_off)) |
132 | error = -EFAULT; | 132 | error = -EFAULT; |
133 | else | 133 | else |
134 | error = count - buf.count; | 134 | error = count - buf.count; |
135 | } | 135 | } |
136 | 136 | ||
137 | fput(file); | 137 | fdput(arg); |
138 | out: | ||
139 | return error; | 138 | return error; |
140 | } | 139 | } |
141 | 140 | ||