Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Handle absolute symlinks to the root.
details: https://anonhg.NetBSD.org/src/rev/076146cbef2d
branches: trunk
changeset: 768278:076146cbef2d
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat Aug 13 19:40:02 2011 +0000
description:
Handle absolute symlinks to the root.
Fixes panic on `ln -s / foo && cd foo' found by ober by trying to run
wine.
ok dholland
diffstat:
sys/kern/vfs_lookup.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diffs (39 lines):
diff -r dd41b3f0a5f1 -r 076146cbef2d sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c Sat Aug 13 19:23:34 2011 +0000
+++ b/sys/kern/vfs_lookup.c Sat Aug 13 19:40:02 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_lookup.c,v 1.188 2011/08/10 05:42:32 dholland Exp $ */
+/* $NetBSD: vfs_lookup.c,v 1.189 2011/08/13 19:40:02 riastradh Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.188 2011/08/10 05:42:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.189 2011/08/13 19:40:02 riastradh Exp $");
#include "opt_magiclinks.h"
@@ -1217,6 +1217,20 @@
/* namei_follow unlocks it (ugh) so rele, not put */
vrele(foundobj);
foundobj = NULL;
+
+ /*
+ * If we followed a symlink to `/' and there
+ * are no more components after the symlink,
+ * we're done with the loop and what we found
+ * is the searchdir.
+ */
+ if (cnp->cn_nameptr[0] == '\0') {
+ foundobj = searchdir;
+ searchdir = NULL;
+ cnp->cn_flags |= ISLASTCN;
+ break;
+ }
+
continue;
}
Home |
Main Index |
Thread Index |
Old Index