summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-05 18:07:06 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-05 18:15:05 +0200
commitea911bc1251825e34faabe1cb87479d6071a30e9 (patch)
treeca2fd23e732e9efadfbb5a74e8d4bb8f0ab9a559
parent95e74d1776eb60e0bcada934efa7f28c31dba26b (diff)
downloadserenity-ea911bc1251825e34faabe1cb87479d6071a30e9.zip
Kernel: Use TRY() in sys$pledge()
-rw-r--r--Kernel/Syscalls/pledge.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/Kernel/Syscalls/pledge.cpp b/Kernel/Syscalls/pledge.cpp
index 2354d575f6..0d75d048f0 100644
--- a/Kernel/Syscalls/pledge.cpp
+++ b/Kernel/Syscalls/pledge.cpp
@@ -19,18 +19,12 @@ KResultOr<FlatPtr> Process::sys$pledge(Userspace<const Syscall::SC_pledge_params
OwnPtr<KString> promises;
if (params.promises.characters) {
- auto promises_or_error = try_copy_kstring_from_user(params.promises);
- if (promises_or_error.is_error())
- return promises_or_error.error();
- promises = promises_or_error.release_value();
+ promises = TRY(try_copy_kstring_from_user(params.promises));
}
OwnPtr<KString> execpromises;
if (params.execpromises.characters) {
- auto execpromises_or_error = try_copy_kstring_from_user(params.execpromises);
- if (execpromises_or_error.is_error())
- return execpromises_or_error.error();
- execpromises = execpromises_or_error.release_value();
+ execpromises = TRY(try_copy_kstring_from_user(params.execpromises));
}
auto parse_pledge = [&](auto pledge_spec, u32& mask) {