Skip to content

Commit 1f475f7

Browse files
committed
Kernel: Use TRY() in sys$realpath()
1 parent 4ea3dc7 commit 1f475f7

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Kernel/Syscalls/realpath.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,9 @@ KResultOr<FlatPtr> Process::sys$realpath(Userspace<const Syscall::SC_realpath_pa
1717
REQUIRE_PROMISE(rpath);
1818
auto params = TRY(copy_typed_from_user(user_params));
1919

20-
auto path = get_syscall_path_argument(params.path);
21-
if (path.is_error())
22-
return path.error();
20+
auto path = TRY(get_syscall_path_argument(params.path));
21+
auto custody = TRY(VirtualFileSystem::the().resolve_path(path->view(), current_directory()));
2322

24-
auto custody_or_error = VirtualFileSystem::the().resolve_path(path.value()->view(), current_directory());
25-
if (custody_or_error.is_error())
26-
return custody_or_error.error();
27-
auto& custody = custody_or_error.value();
2823
auto absolute_path = custody->try_create_absolute_path();
2924
if (!absolute_path)
3025
return ENOMEM;

0 commit comments

Comments
 (0)