1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

Kernel: Use TRY() in sys$rename()

This commit is contained in:
Andreas Kling 2021-09-05 17:53:59 +02:00
parent c5d046c23a
commit 780737de7a

View file

@ -15,14 +15,9 @@ KResultOr<FlatPtr> Process::sys$rename(Userspace<const Syscall::SC_rename_params
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(cpath);
auto params = TRY(copy_typed_from_user(user_params));
auto old_path = get_syscall_path_argument(params.old_path);
if (old_path.is_error())
return old_path.error();
auto new_path = get_syscall_path_argument(params.new_path);
if (new_path.is_error())
return new_path.error();
return VirtualFileSystem::the().rename(old_path.value()->view(), new_path.value()->view(), current_directory());
auto old_path = TRY(get_syscall_path_argument(params.old_path));
auto new_path = TRY(get_syscall_path_argument(params.new_path));
return VirtualFileSystem::the().rename(old_path->view(), new_path->view(), current_directory());
}
}