summaryrefslogtreecommitdiff
path: root/kernel/fs/vfs.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2023-11-16 15:12:50 +0100
committerAnton Kling <anton@kling.gg>2023-11-16 15:12:50 +0100
commit6164f8564e94ffa7ee8fbfcc82f4350a35ab08a5 (patch)
tree0a59f947220c7e3f687c30178053d8db494e74fb /kernel/fs/vfs.c
parentf4cf0cac3fbefce2454a0e96ab32000a12b54253 (diff)
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.
Diffstat (limited to 'kernel/fs/vfs.c')
-rw-r--r--kernel/fs/vfs.c4
1 files changed, 0 insertions, 4 deletions
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;
}