From 0cc0b6fc8f3451e7e793980e2a3035675805ade8 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 2 Apr 2008 00:51:43 +0000 Subject: [PATCH] * Fixed resolution of symlinks path components, broken since r24721/r24722. After resolving a symlink we weren't updating the local type variable to the type of the link target, so that the directory check in the next iteration would always fail. * Added TODO. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24735 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/fs/vfs.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index 87b8684a56..fe1271c46b 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -1756,6 +1756,10 @@ vnode_path_to_vnode(struct vnode *vnode, char *path, bool traverseLeafLink, status_t status = B_OK; ino_t lastParentID = vnode->id; int type = 0; + // TODO: Actually the caller could provide the type of the start node, + // if known, which it is in most cases (context root, mount root, cwd). + // We'd save a now always required read_stat(). + // Doing that via _type wouldn't even require an interface change. FUNCTION(("vnode_path_to_vnode(vnode = %p, path = %s)\n", vnode, path)); @@ -1923,9 +1927,10 @@ vnode_path_to_vnode(struct vnode *vnode, char *path, bool traverseLeafLink, if (absoluteSymlink && *path == '\0') { // symlink was just "/" nextVnode = vnode; + type = S_IFDIR; } else { status = vnode_path_to_vnode(vnode, path, traverseLeafLink, - count + 1, ioContext, &nextVnode, &lastParentID, _type); + count + 1, ioContext, &nextVnode, &lastParentID, &type); } free(buffer);