From 872b00c09a673330db239818ece5bcc822df0c18 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Tue, 1 Feb 2005 14:43:44 +0000 Subject: [PATCH] Always honor fdp->fd_nrdir as root. Once the loop reached NCF_ROOT, fdp->fd_nrdir has to be equal to the current ncp or the original ncp is not below fdp->fd_nrdir. In the latter case, just return "/" as fullpath. --- sys/kern/vfs_cache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 22b710598d..ec7eecb445 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -67,7 +67,7 @@ * * @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95 * $FreeBSD: src/sys/kern/vfs_cache.c,v 1.42.2.6 2001/10/05 20:07:03 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_cache.c,v 1.48 2005/01/31 18:11:06 joerg Exp $ + * $DragonFly: src/sys/kern/vfs_cache.c,v 1.49 2005/02/01 14:43:44 joerg Exp $ */ #include @@ -1803,6 +1803,11 @@ cache_fullpath(struct proc *p, struct namecache *ncp, char **retbuf, char **free free(buf, M_TEMP); return(ENOENT); } + if ((ncp->nc_flag & NCF_ROOT) && ncp != fdp->fd_nrdir) { + bp = buf + MAXPATHLEN - 1; + *bp = '\0'; + slash_prefixed = 0; + } if (!slash_prefixed) { if (bp == buf) { numfullpathfail4++; -- 2.41.0