Source-Changes-HG archive

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

[src/trunk]: src/sys/kern description:



details:   https://anonhg.NetBSD.org/src/rev/b9109a618baa
branches:  trunk
changeset: 764081:b9109a618baa
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Apr 11 02:19:11 2011 +0000

description:
description:
namei_follow() randomly drops foundobj on success. Do that in the
caller instead. On the other hand, the caller was updating cn_nameptr,
and since that's closely related to the buffer manipulation in
namei_follow, do that there.

diffstat:

 sys/kern/vfs_lookup.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r ca002f9453e5 -r b9109a618baa sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Mon Apr 11 02:18:20 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Mon Apr 11 02:19:11 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.166 2011/04/11 02:18:20 dholland Exp $        */
+/*     $NetBSD: vfs_lookup.c,v 1.167 2011/04/11 02:19:11 dholland Exp $        */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.166 2011/04/11 02:18:20 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.167 2011/04/11 02:19:11 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -692,7 +692,9 @@
        ndp->ni_pathlen += linklen;
        memcpy(ndp->ni_pnbuf, cp, ndp->ni_pathlen);
        PNBUF_PUT(cp);
-       vput(foundobj);
+
+       /* we're now starting from the beginning of the buffer again */
+       cnp->cn_nameptr = ndp->ni_pnbuf;
 
        /*
         * Check if root directory should replace current directory.
@@ -1181,7 +1183,8 @@
                                ndp->ni_vp = NULL;
                                return error;
                        }
-                       cnp->cn_nameptr = ndp->ni_pnbuf;
+                       vput(foundobj);
+                       foundobj = NULL;
                        continue;
                }
 



Home | Main Index | Thread Index | Old Index