Module Name: src
Committed By: dholland
Date: Mon Apr 11 02:19:12 UTC 2011
Modified Files:
src/sys/kern: vfs_lookup.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/kern/vfs_lookup.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.166 src/sys/kern/vfs_lookup.c:1.167
--- src/sys/kern/vfs_lookup.c:1.166 Mon Apr 11 02:18:20 2011
+++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:19:11 2011
@@ -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;
}