diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 13:22:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 13:22:40 -0400 |
commit | 5ed487bc2c44ca4e9668ef9cb54c830e2a9fac47 (patch) | |
tree | af19ed28db83e8f52690872ac99336da1cf2fd3b /fs/readdir.c | |
parent | 5b34653963de7a6d0d8c783527457d68fddc60fb (diff) | |
parent | fd217f4d70172c526478f2bc76859e909fdfa674 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (46 commits)
[PATCH] fs: add a sanity check in d_free
[PATCH] i_version: remount support
[patch] vfs: make security_inode_setattr() calling consistent
[patch 1/3] FS_MBCACHE: don't needlessly make it built-in
[PATCH] move executable checking into ->permission()
[PATCH] fs/dcache.c: update comment of d_validate()
[RFC PATCH] touch_mnt_namespace when the mount flags change
[PATCH] reiserfs: add missing llseek method
[PATCH] fix ->llseek for more directories
[PATCH vfs-2.6 6/6] vfs: add LOOKUP_RENAME_TARGET intent
[PATCH vfs-2.6 5/6] vfs: remove LOOKUP_PARENT from non LOOKUP_PARENT lookup
[PATCH vfs-2.6 4/6] vfs: remove unnecessary fsnotify_d_instantiate()
[PATCH vfs-2.6 3/6] vfs: add __d_instantiate() helper
[PATCH vfs-2.6 2/6] vfs: add d_ancestor()
[PATCH vfs-2.6 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT()
[PATCH] get rid of on-stack dentry in udf
[PATCH 2/2] anondev: switch to IDA
[PATCH 1/2] anondev: init IDR statically
[JFFS2] Use d_splice_alias() not d_add() in jffs2_lookup()
[PATCH] Optimise NFS readdir hack slightly.
...
Diffstat (limited to 'fs/readdir.c')
-rw-r--r-- | fs/readdir.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/fs/readdir.c b/fs/readdir.c index 93a7559bbfd8..b318d9b5af2e 100644 --- a/fs/readdir.c +++ b/fs/readdir.c | |||
@@ -117,7 +117,7 @@ asmlinkage long old_readdir(unsigned int fd, struct old_linux_dirent __user * di | |||
117 | buf.dirent = dirent; | 117 | buf.dirent = dirent; |
118 | 118 | ||
119 | error = vfs_readdir(file, fillonedir, &buf); | 119 | error = vfs_readdir(file, fillonedir, &buf); |
120 | if (error >= 0) | 120 | if (buf.result) |
121 | error = buf.result; | 121 | error = buf.result; |
122 | 122 | ||
123 | fput(file); | 123 | fput(file); |
@@ -209,9 +209,8 @@ asmlinkage long sys_getdents(unsigned int fd, struct linux_dirent __user * diren | |||
209 | buf.error = 0; | 209 | buf.error = 0; |
210 | 210 | ||
211 | error = vfs_readdir(file, filldir, &buf); | 211 | error = vfs_readdir(file, filldir, &buf); |
212 | if (error < 0) | 212 | if (error >= 0) |
213 | goto out_putf; | 213 | error = buf.error; |
214 | error = buf.error; | ||
215 | lastdirent = buf.previous; | 214 | lastdirent = buf.previous; |
216 | if (lastdirent) { | 215 | if (lastdirent) { |
217 | if (put_user(file->f_pos, &lastdirent->d_off)) | 216 | if (put_user(file->f_pos, &lastdirent->d_off)) |
@@ -219,8 +218,6 @@ asmlinkage long sys_getdents(unsigned int fd, struct linux_dirent __user * diren | |||
219 | else | 218 | else |
220 | error = count - buf.count; | 219 | error = count - buf.count; |
221 | } | 220 | } |
222 | |||
223 | out_putf: | ||
224 | fput(file); | 221 | fput(file); |
225 | out: | 222 | out: |
226 | return error; | 223 | return error; |
@@ -293,19 +290,16 @@ asmlinkage long sys_getdents64(unsigned int fd, struct linux_dirent64 __user * d | |||
293 | buf.error = 0; | 290 | buf.error = 0; |
294 | 291 | ||
295 | error = vfs_readdir(file, filldir64, &buf); | 292 | error = vfs_readdir(file, filldir64, &buf); |
296 | if (error < 0) | 293 | if (error >= 0) |
297 | goto out_putf; | 294 | error = buf.error; |
298 | error = buf.error; | ||
299 | lastdirent = buf.previous; | 295 | lastdirent = buf.previous; |
300 | if (lastdirent) { | 296 | if (lastdirent) { |
301 | typeof(lastdirent->d_off) d_off = file->f_pos; | 297 | typeof(lastdirent->d_off) d_off = file->f_pos; |
302 | error = -EFAULT; | ||
303 | if (__put_user(d_off, &lastdirent->d_off)) | 298 | if (__put_user(d_off, &lastdirent->d_off)) |
304 | goto out_putf; | 299 | error = -EFAULT; |
305 | error = count - buf.count; | 300 | else |
301 | error = count - buf.count; | ||
306 | } | 302 | } |
307 | |||
308 | out_putf: | ||
309 | fput(file); | 303 | fput(file); |
310 | out: | 304 | out: |
311 | return error; | 305 | return error; |