Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/common On linux_sys_getdents, insert d_type...



details:   https://anonhg.NetBSD.org/src/rev/4683b3726e24
branches:  trunk
changeset: 791252:4683b3726e24
user:      slp <slp%NetBSD.org@localhost>
date:      Sun Nov 10 12:07:52 2013 +0000

description:
On linux_sys_getdents, insert d_type at the end of each record.
Fixes PR kern/47806.

diffstat:

 sys/compat/linux/common/linux_misc.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 3877caf9c944 -r 4683b3726e24 sys/compat/linux/common/linux_misc.c
--- a/sys/compat/linux/common/linux_misc.c      Sun Nov 10 05:16:10 2013 +0000
+++ b/sys/compat/linux/common/linux_misc.c      Sun Nov 10 12:07:52 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_misc.c,v 1.226 2013/09/24 13:27:50 njoly Exp $   */
+/*     $NetBSD: linux_misc.c,v 1.227 2013/11/10 12:07:52 slp Exp $     */
 
 /*-
  * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.226 2013/09/24 13:27:50 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.227 2013/11/10 12:07:52 slp Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -784,9 +784,10 @@
                        }
                        idb.d_off = (linux_off_t)off;
                        idb.d_reclen = (u_short)linux_reclen;
+                       /* Linux puts d_type at the end of each record */
+                       *((char *)&idb + idb.d_reclen - 1) = bdp->d_type;
                }
                strcpy(idb.d_name, bdp->d_name);
-               idb.d_name[strlen(idb.d_name) + 1] = bdp->d_type;
                if ((error = copyout((void *)&idb, outp, linux_reclen)))
                        goto out;
                /* advance past this real entry */



Home | Main Index | Thread Index | Old Index