summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/realpath.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-05 17:59:38 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-05 18:15:05 +0200
commit1f475f7bbcc816e91f54d72b003b2d10b91bbef8 (patch)
treee1b4e79a682ae1666e5245b1701278af4d3dfc1d /Kernel/Syscalls/realpath.cpp
parent4ea3dc77f0c4739483df055cee5cc0ec9bb7227b (diff)
downloadserenity-1f475f7bbcc816e91f54d72b003b2d10b91bbef8.zip
Kernel: Use TRY() in sys$realpath()
Diffstat (limited to 'Kernel/Syscalls/realpath.cpp')
-rw-r--r--Kernel/Syscalls/realpath.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/Kernel/Syscalls/realpath.cpp b/Kernel/Syscalls/realpath.cpp
index 4262c4adef..bbb44e026c 100644
--- a/Kernel/Syscalls/realpath.cpp
+++ b/Kernel/Syscalls/realpath.cpp
@@ -17,14 +17,9 @@ KResultOr<FlatPtr> Process::sys$realpath(Userspace<const Syscall::SC_realpath_pa
REQUIRE_PROMISE(rpath);
auto params = TRY(copy_typed_from_user(user_params));
- auto path = get_syscall_path_argument(params.path);
- if (path.is_error())
- return path.error();
+ auto path = TRY(get_syscall_path_argument(params.path));
+ auto custody = TRY(VirtualFileSystem::the().resolve_path(path->view(), current_directory()));
- auto custody_or_error = VirtualFileSystem::the().resolve_path(path.value()->view(), current_directory());
- if (custody_or_error.is_error())
- return custody_or_error.error();
- auto& custody = custody_or_error.value();
auto absolute_path = custody->try_create_absolute_path();
if (!absolute_path)
return ENOMEM;