From 4ea3dc77f0c4739483df055cee5cc0ec9bb7227b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 5 Sep 2021 17:58:55 +0200 Subject: [PATCH] Kernel: Use TRY() in sys$statvfs() --- Kernel/Syscalls/statvfs.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Kernel/Syscalls/statvfs.cpp b/Kernel/Syscalls/statvfs.cpp index 08ba9a8984c..e9a91bc5026 100644 --- a/Kernel/Syscalls/statvfs.cpp +++ b/Kernel/Syscalls/statvfs.cpp @@ -12,11 +12,7 @@ namespace Kernel { KResultOr Process::do_statvfs(String path, statvfs* buf) { - auto custody_or_error = VirtualFileSystem::the().resolve_path(path, current_directory(), nullptr, 0); - if (custody_or_error.is_error()) - return custody_or_error.error(); - - auto& custody = custody_or_error.value(); + auto custody = TRY(VirtualFileSystem::the().resolve_path(path, current_directory(), nullptr, 0)); auto& inode = custody->inode(); auto& fs = inode.fs(); @@ -71,11 +67,8 @@ KResultOr Process::sys$statvfs(Userspaceview(), params.buf); + auto path = TRY(get_syscall_path_argument(params.path)); + return do_statvfs(path->view(), params.buf); } KResultOr Process::sys$fstatvfs(int fd, statvfs* buf)