From de73100825d330c9be828c508dd64d4d31cb6a2e Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 2 Apr 2008 01:55:37 +0000 Subject: [PATCH] Also check whether the supplied vnode is a directory, if there's only one path component. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24736 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/fs/vfs.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index fe1271c46b..dd605b1cd9 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -1811,21 +1811,21 @@ vnode_path_to_vnode(struct vnode *vnode, char *path, bool traverseLeafLink, put_vnode(vnode); vnode = nextVnode; } - } else if (nextPath[0]) { - // check if vnode is really a directory - if (type == 0) { - // we need to retrieve the type first - struct stat stat; - status = FS_CALL(vnode, read_stat)(vnode->mount->cookie, - vnode->private_node, &stat); - if (status == B_OK) - type = stat.st_mode; - } - - if (status == B_OK && !S_ISDIR(type)) - status = B_NOT_A_DIRECTORY; } + // check if vnode is really a directory + if (type == 0) { + // we need to retrieve the type first + struct stat stat; + status = FS_CALL(vnode, read_stat)(vnode->mount->cookie, + vnode->private_node, &stat); + if (status == B_OK) + type = stat.st_mode; + } + + if (status == B_OK && !S_ISDIR(type)) + status = B_NOT_A_DIRECTORY; + // Check if we have the right to search the current directory vnode. // If a file system doesn't have the access() function, we assume that // searching a directory is always allowed