mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:38:10 +00:00
Kernel: Make chdir() take path+length
This commit is contained in:
parent
f231e9ea76
commit
c5890afc8b
3 changed files with 6 additions and 5 deletions
|
@ -1555,12 +1555,13 @@ int Process::sys$readlink(const char* path, char* buffer, ssize_t size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$chdir(const char* path)
|
||||
int Process::sys$chdir(const char* user_path, size_t path_length)
|
||||
{
|
||||
SmapDisabler disabler;
|
||||
if (!validate_read_str(path))
|
||||
if (!validate_read(user_path, path_length))
|
||||
return -EFAULT;
|
||||
auto directory_or_error = VFS::the().open_directory(StringView(path), current_directory());
|
||||
auto path = copy_string_from_user(user_path, path_length);
|
||||
auto directory_or_error = VFS::the().open_directory(path, current_directory());
|
||||
if (directory_or_error.is_error())
|
||||
return directory_or_error.error();
|
||||
m_cwd = *directory_or_error.value();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue