mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:27:43 +00:00
Kernel: Use TRY() in sys$rename()
This commit is contained in:
parent
c5d046c23a
commit
780737de7a
1 changed files with 3 additions and 8 deletions
|
@ -15,14 +15,9 @@ KResultOr<FlatPtr> Process::sys$rename(Userspace<const Syscall::SC_rename_params
|
||||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
|
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
|
||||||
REQUIRE_PROMISE(cpath);
|
REQUIRE_PROMISE(cpath);
|
||||||
auto params = TRY(copy_typed_from_user(user_params));
|
auto params = TRY(copy_typed_from_user(user_params));
|
||||||
|
auto old_path = TRY(get_syscall_path_argument(params.old_path));
|
||||||
auto old_path = get_syscall_path_argument(params.old_path);
|
auto new_path = TRY(get_syscall_path_argument(params.new_path));
|
||||||
if (old_path.is_error())
|
return VirtualFileSystem::the().rename(old_path->view(), new_path->view(), current_directory());
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue