summaryrefslogtreecommitdiff
path: root/sys/compat/common
diff options
context:
space:
mode:
authorPaul Irofti <pirofti@cvs.openbsd.org>2013-10-31 09:53:57 +0000
committerPaul Irofti <pirofti@cvs.openbsd.org>2013-10-31 09:53:57 +0000
commit2b88f22e6f17fd34585090317cd0b5a6f3f4e467 (patch)
tree4a5ec547289f8733a0d7046af6a30b6a5104e717 /sys/compat/common
parent35d0986418b88266db39a46b310d2a765abfc48e (diff)
Fix readdir_with_callback() after cookies removal.
The non-cookie path was probably always broken and never used. The file descriptor offset was never updated after a read so glibc and other syscall consumers would end-up in an infinite loop. Tested with the syscalls regression suite from IBM and with opera.
Diffstat (limited to 'sys/compat/common')
-rw-r--r--sys/compat/common/compat_dir.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sys/compat/common/compat_dir.c b/sys/compat/common/compat_dir.c
index 666e690d24b..f41c509da82 100644
--- a/sys/compat/common/compat_dir.c
+++ b/sys/compat/common/compat_dir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: compat_dir.c,v 1.6 2013/08/13 05:52:21 guenther Exp $ */
+/* $OpenBSD: compat_dir.c,v 1.7 2013/10/31 09:53:56 pirofti Exp $ */
/*
* Copyright (c) 2000 Constantine Sapuntzakis
@@ -91,6 +91,7 @@ again:
auio.uio_offset = newoff;
error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag);
+ *off = auio.uio_offset;
if (error)
goto out;
@@ -126,9 +127,6 @@ again:
eof:
out:
- if (error == 0)
- *off = newoff;
-
VOP_UNLOCK(vp, 0, curproc);
free(buf, M_TEMP);
return (error);