diff --git a/Kernel/Syscalls/unveil.cpp b/Kernel/Syscalls/unveil.cpp index 9ecf2f0e9e..190af20c05 100644 --- a/Kernel/Syscalls/unveil.cpp +++ b/Kernel/Syscalls/unveil.cpp @@ -45,21 +45,12 @@ KResultOr Process::sys$unveil(Userspace 5) return EINVAL; - auto path_or_error = get_syscall_path_argument(params.path); - if (path_or_error.is_error()) - return path_or_error.error(); - auto& path = *path_or_error.value(); + auto path = TRY(get_syscall_path_argument(params.path)); - if (path.is_empty() || !path.view().starts_with('/')) + if (path->is_empty() || !path->view().starts_with('/')) return EINVAL; - OwnPtr permissions; - { - auto permissions_or_error = try_copy_kstring_from_user(params.permissions); - if (permissions_or_error.is_error()) - return permissions_or_error.error(); - permissions = permissions_or_error.release_value(); - } + auto permissions = TRY(try_copy_kstring_from_user(params.permissions)); // Let's work out permissions first... unsigned new_permissions = 0; @@ -92,7 +83,7 @@ KResultOr Process::sys$unveil(Userspace parent_custody; // Parent inode in case of ENOENT OwnPtr new_unveiled_path; - auto custody_or_error = VirtualFileSystem::the().resolve_path_without_veil(path.view(), VirtualFileSystem::the().root_custody(), &parent_custody); + auto custody_or_error = VirtualFileSystem::the().resolve_path_without_veil(path->view(), VirtualFileSystem::the().root_custody(), &parent_custody); if (!custody_or_error.is_error()) { new_unveiled_path = custody_or_error.value()->try_create_absolute_path(); if (!new_unveiled_path) @@ -101,7 +92,7 @@ KResultOr Process::sys$unveil(Userspacetry_create_absolute_path(); if (!parent_custody_path) return ENOMEM; - new_unveiled_path = KLexicalPath::try_join(parent_custody_path->view(), KLexicalPath::basename(path.view())); + new_unveiled_path = KLexicalPath::try_join(parent_custody_path->view(), KLexicalPath::basename(path->view())); if (!new_unveiled_path) return ENOMEM; } else {