From f2f5df793a6c683d7c33423e22b525dca317254a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 5 Sep 2021 14:41:13 +0200 Subject: [PATCH] Kernel: Use TRY() in sys$chdir() --- Kernel/Syscalls/chdir.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Kernel/Syscalls/chdir.cpp b/Kernel/Syscalls/chdir.cpp index ee70543b29..eeaa1342a2 100644 --- a/Kernel/Syscalls/chdir.cpp +++ b/Kernel/Syscalls/chdir.cpp @@ -14,13 +14,8 @@ KResultOr Process::sys$chdir(Userspace user_path, size_t p { VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this); REQUIRE_PROMISE(rpath); - auto path = get_syscall_path_argument(user_path, path_length); - if (path.is_error()) - 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(); + auto path = TRY(get_syscall_path_argument(user_path, path_length)); + m_cwd = TRY(VirtualFileSystem::the().open_directory(path->view(), current_directory())); return 0; }