From 6164f8564e94ffa7ee8fbfcc82f4350a35ab08a5 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Thu, 16 Nov 2023 15:12:50 +0100 Subject: ext2: Fix directory resolution Previously a parsing of /usr/../ would fail as it would be searching '/' for a empty file even though the desired outcome if for it to stop parsing after reaching '/'. The solution is to give the current directory inode if the file searched for in the directory is empty. --- kernel/fs/vfs.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'kernel/fs/vfs.c') diff --git a/kernel/fs/vfs.c b/kernel/fs/vfs.c index 8c9e08d..2347369 100644 --- a/kernel/fs/vfs.c +++ b/kernel/fs/vfs.c @@ -95,7 +95,6 @@ int vfs_create_file(const char *file) { file); return 0; } - // ext2_create_file("/etc/oscreated", 0); assert(file_mount->local_root->create_file); return file_mount->local_root->create_file(file, 0); } @@ -127,7 +126,6 @@ vfs_inode_t *vfs_internal_open(const char *file) { } char *vfs_clean_path(const char *path, char *resolved_path) { - // char *const clean = kmalloc(strlen(path) + 1); char *clean = resolved_path; int prev_slash = 0; char *ptr = clean; @@ -151,12 +149,10 @@ char *vfs_resolve_path(const char *file, char *resolved_path) { size_t l = strlen(cwd); assert(l > 0); assert('/' == cwd[l - 1]); - // char *r = kmalloc(l + strlen(file) + 1); char r[256]; strcpy(r, cwd); strcat(r, file); char *final = vfs_clean_path(r, resolved_path); - // kfree(r); return final; } -- cgit v1.2.3