mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 06:58:22 +00:00
vfs: properly handle empty paths
This commit is contained in:
+3
-14
@@ -708,20 +708,8 @@ int vfs_lookup(vnode_t **result, vnode_t *start, char *path, char *lastcomp, int
|
|||||||
|
|
||||||
size_t pathlen = strlen(path);
|
size_t pathlen = strlen(path);
|
||||||
|
|
||||||
if (pathlen == 0) {
|
if (pathlen == 0)
|
||||||
if (flags & VFS_LOOKUP_PARENT) {
|
return ENOENT;
|
||||||
return ENOENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
vnode_t *r = start;
|
|
||||||
int e = highestnodeinmp(start, &r);
|
|
||||||
if (e)
|
|
||||||
return e;
|
|
||||||
|
|
||||||
VOP_HOLD(r);
|
|
||||||
*result = r;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pathlen > PATHNAME_MAX)
|
if (pathlen > PATHNAME_MAX)
|
||||||
return ENAMETOOLONG;
|
return ENAMETOOLONG;
|
||||||
@@ -744,6 +732,7 @@ int vfs_lookup(vnode_t **result, vnode_t *start, char *path, char *lastcomp, int
|
|||||||
|
|
||||||
vnode_t *next;
|
vnode_t *next;
|
||||||
error = 0;
|
error = 0;
|
||||||
|
|
||||||
VOP_HOLD(current);
|
VOP_HOLD(current);
|
||||||
VOP_LOCK(current);
|
VOP_LOCK(current);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user