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
This commit is contained in:
Ingo Weinhold
2008-04-02 01:55:37 +00:00
parent 0cc0b6fc8f
commit de73100825
+13 -13
View File
@@ -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