From c118cb14c0ae7d7672215bc4b829cb7e24ded9e2 Mon Sep 17 00:00:00 2001 From: jdolecek Date: Mon, 20 May 2002 06:40:37 +0000 Subject: [PATCH] linux_sys_getdents64(): make the d_off member point to next entry, rather than current one; this is expected (even documented) behaviour of the new system call This fixes the endless loop when reading directories on NFS, though applications won't see all directory entries due to different problem. Fix by Matthias Scheler and Charles Hannum. --- sys/compat/linux/common/linux_file64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/compat/linux/common/linux_file64.c b/sys/compat/linux/common/linux_file64.c index ff2cb832a92c..0706b28bc4ad 100644 --- a/sys/compat/linux/common/linux_file64.c +++ b/sys/compat/linux/common/linux_file64.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_file64.c,v 1.16 2002/05/19 18:03:17 jdolecek Exp $ */ +/* $NetBSD: linux_file64.c,v 1.17 2002/05/20 06:40:37 jdolecek Exp $ */ /*- * Copyright (c) 1995, 1998, 2000 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.16 2002/05/19 18:03:17 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.17 2002/05/20 06:40:37 jdolecek Exp $"); #include #include @@ -458,6 +458,7 @@ again: outp++; break; } + off = *cookie++; /* each entry points to next */ /* * Massage in place to make a Linux-shaped dirent (otherwise * we have to worry about touching user memory outside of @@ -480,7 +481,6 @@ again: goto out; /* advance past this real entry */ inp += reclen; - off = *cookie++; /* each entry points to itself */ /* advance output past Linux-shaped entry */ outp += linux_reclen; resid -= linux_reclen;