syscalls: fix cwd-related stuff

This commit is contained in:
2025-07-18 21:02:54 +03:00
parent 359e5c6d78
commit 3ae26ed88a
6 changed files with 37 additions and 11 deletions
+4 -6
View File
@@ -232,17 +232,15 @@ int sys_close(TrapFrame *tf)
int sys_chdir(TrapFrame *tf)
{
strcat(current->cwd->fat->path, "/");
strcat(current->cwd->fat->path, (char*)tf->ebx);
return fat_opendir(current->cwd, (const char*)tf->ebx);
}
int sys_getcwd(TrapFrame *tf)
{
int len = tf->ecx;
if(len >= 260)
return (int)NULL;
memcpy((void*)tf->ebx, current->cwd->fat->name, current->cwd->fat->namelen);
strcpy((char*)tf->ebx, current->cwd->fat->path);
return tf->ebx;
}