vfs: fix trailing slashes on lookup

This commit is contained in:
Matheus
2023-05-01 00:44:56 -03:00
parent c2e15306b3
commit d90f8d0950
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -256,6 +256,13 @@ int vfs_lookup(vnode_t **result, vnode_t *start, char *path, char *lastcomp, int
size_t complen = strlen(component);
bool islast = i + complen == pathlen;
// check if its last with trailing '/' (or '\0's in this case, as '/'s were turned into '\0's in the buffer)
if (!islast) {
int j;
for (j = i + complen; j < pathlen && compbuffer[j] == '\0'; ++j);
islast = j == pathlen;
}
if (islast && (flags & VFS_LOOKUP_PARENT)) {
strcpy(lastcomp, component);
break;