mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
Kernel: Use TRY() in sys$chdir()
This commit is contained in:
parent
5ba10c6017
commit
f2f5df793a
1 changed files with 2 additions and 7 deletions
|
@ -14,13 +14,8 @@ KResultOr<FlatPtr> Process::sys$chdir(Userspace<const char*> user_path, size_t p
|
||||||
{
|
{
|
||||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||||
REQUIRE_PROMISE(rpath);
|
REQUIRE_PROMISE(rpath);
|
||||||
auto path = get_syscall_path_argument(user_path, path_length);
|
auto path = TRY(get_syscall_path_argument(user_path, path_length));
|
||||||
if (path.is_error())
|
m_cwd = TRY(VirtualFileSystem::the().open_directory(path->view(), current_directory()));
|
||||||
return path.error();
|
|
||||||
auto directory_or_error = VirtualFileSystem::the().open_directory(path.value()->view(), current_directory());
|
|
||||||
if (directory_or_error.is_error())
|
|
||||||
return directory_or_error.error();
|
|
||||||
m_cwd = *directory_or_error.value();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue