diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-05 17:58:55 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-05 18:15:05 +0200 |
commit | 4ea3dc77f0c4739483df055cee5cc0ec9bb7227b (patch) | |
tree | 7a865094255ebe74d9bb1f1f507f66b12c260195 /Kernel/Syscalls/statvfs.cpp | |
parent | 7efa742a39e9646a0e88ad55b0c401c46ff0c458 (diff) | |
download | serenity-4ea3dc77f0c4739483df055cee5cc0ec9bb7227b.zip |
Kernel: Use TRY() in sys$statvfs()
Diffstat (limited to 'Kernel/Syscalls/statvfs.cpp')
-rw-r--r-- | Kernel/Syscalls/statvfs.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/Kernel/Syscalls/statvfs.cpp b/Kernel/Syscalls/statvfs.cpp index 08ba9a8984..e9a91bc502 100644 --- a/Kernel/Syscalls/statvfs.cpp +++ b/Kernel/Syscalls/statvfs.cpp @@ -12,11 +12,7 @@ namespace Kernel { KResultOr<FlatPtr> 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<FlatPtr> Process::sys$statvfs(Userspace<const Syscall::SC_statvfs_para 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(); - - return do_statvfs(path.value()->view(), params.buf); + auto path = TRY(get_syscall_path_argument(params.path)); + return do_statvfs(path->view(), params.buf); } KResultOr<FlatPtr> Process::sys$fstatvfs(int fd, statvfs* buf) |