diff options
author | phk <phk@FreeBSD.org> | 1997-09-28 06:37:02 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1997-09-28 06:37:02 +0000 |
commit | 93c5769c6c8781226a9ec9ccde10a6b9785f83a4 (patch) | |
tree | ee7d9d65d4a09cfbd1126ff3c4510df7707e53d1 | |
parent | 7890a25c743065a14dca280f0dd17bce04d93a85 (diff) | |
download | FreeBSD-src-93c5769c6c8781226a9ec9ccde10a6b9785f83a4.zip FreeBSD-src-93c5769c6c8781226a9ec9ccde10a6b9785f83a4.tar.gz |
Fix handling of nested mountpoints in __getcwd()
Detected by: Simon Shapiro <Shimon@i-Connect.Net>
-rw-r--r-- | sys/kern/vfs_extattr.c | 8 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index d3b100b..0450d16 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.73 1997/09/24 07:46:54 phk Exp $ + * $Id: vfs_syscalls.c,v 1.74 1997/09/27 13:39:06 kato Exp $ */ /* @@ -2809,6 +2809,10 @@ __getcwd(p, uap, retval) *bp = '\0'; numcwdcalls++; for (vp = fdp->fd_cdir; vp != fdp->fd_rdir && vp != rootvnode;) { + if (vp->v_flag & VROOT) { + vp = vp->v_mount->mnt_vnodecovered; + continue; + } if (vp->v_dd->v_id != vp->v_ddid) { numcwdfail1++; free(buf, M_TEMP); @@ -2841,8 +2845,6 @@ __getcwd(p, uap, retval) *--bp = '/'; j++; vp = vp->v_dd; - if (vp->v_flag & VROOT) - vp = vp->v_mount->mnt_vnodecovered; } if (!j) { if (bp == buf) { diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index d3b100b..0450d16 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.73 1997/09/24 07:46:54 phk Exp $ + * $Id: vfs_syscalls.c,v 1.74 1997/09/27 13:39:06 kato Exp $ */ /* @@ -2809,6 +2809,10 @@ __getcwd(p, uap, retval) *bp = '\0'; numcwdcalls++; for (vp = fdp->fd_cdir; vp != fdp->fd_rdir && vp != rootvnode;) { + if (vp->v_flag & VROOT) { + vp = vp->v_mount->mnt_vnodecovered; + continue; + } if (vp->v_dd->v_id != vp->v_ddid) { numcwdfail1++; free(buf, M_TEMP); @@ -2841,8 +2845,6 @@ __getcwd(p, uap, retval) *--bp = '/'; j++; vp = vp->v_dd; - if (vp->v_flag & VROOT) - vp = vp->v_mount->mnt_vnodecovered; } if (!j) { if (bp == buf) { |