syscalls: stop requiring a trailing slash for directories in chdir and vfs: emove some debug_log calls in follow_path

This commit is contained in:
2025-11-20 20:13:45 +03:00
parent 827189593c
commit 0b0492e756
2 changed files with 19 additions and 9 deletions
+8 -9
View File
@@ -240,8 +240,8 @@ int follow_path(const char* path, l9660_file* file, l9660_dir* dir)
start_from_root = 1;
pos++;
l9660_fs_open_root(dir, global_fs);
debug_log("start_from_root\n");
debug_log("/");
//debug_log("start_from_root\n");
//debug_log("/");
}
//printf("start_from_root: %X\n\n", start_from_root);
@@ -261,12 +261,12 @@ int follow_path(const char* path, l9660_file* file, l9660_dir* dir)
if(path[pos] != '\0')
{
isdir = 1;
debug_log("%s->", buf);//this is a directory
//debug_log("%s->", buf);//this is a directory
l9660_dir dir2;
status = l9660_opendirat(&dir2, dir, buf);
if(status != L9660_OK)
{
debug_log("FUCKFUCKFUCKFUCK BLYAAAT!!!!!\n");
//debug_log("FUCKFUCKFUCKFUCK BLYAAAT!!!!!\n");
return status;
}
*dir = dir2;
@@ -274,20 +274,20 @@ int follow_path(const char* path, l9660_file* file, l9660_dir* dir)
else
{
isdir = 0;
debug_log("%s", buf);//this is a file
//debug_log("%s", buf);//this is a file
status = l9660_openat(file, dir, buf);
if(status != L9660_OK)
{
debug_log("PIZDAPIZDA BLYAAAT!!!!!\n");
//debug_log("PIZDAPIZDA BLYAAAT!!!!!\n");
return status;
}
return status;
}
pos++;
}
debug_log("\n");
//debug_log("\n");
//printf("buf: %s\n", buf);
debug_log("isdir: %X\n", isdir);
//debug_log("isdir: %X\n", isdir);
return status;
}
@@ -300,7 +300,6 @@ int follow_path(const char* path, l9660_file* file, l9660_dir* dir)
bool is_root_dir(l9660_dir* dir) {
l9660_dirent* dent;
l9660_status status;
l9660_seekdir(dir, 0);//rewind to start
l9660_readdir(dir, &dent);//reaed .
+11
View File
@@ -454,6 +454,17 @@ int sys_chdir(TrapFrame *tf)
*(current->cwd) = new_cwd;
}
if(status == L9660_ENOTFILE)
{
l9660_dir dir1;
l9660_status err = l9660_opendirat(&dir1, &new_cwd, (char*)tf->ebx);
if(err != L9660_ENOTDIR)
{
*(current->cwd) = dir1;
return 0;
}
}
switch(status)
{
case L9660_EIO: