summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-11-27 11:22:25 +0100
committerAndreas Kling <kling@serenityos.org>2021-12-05 22:59:09 +0100
commit0e6e1092f0af0c69a639105bc16bd9efcf1ad690 (patch)
tree2025095bbdfa8b65b7278c922375b27bb404a8ce /Kernel/Syscalls
parent49adebf0fcf84733bde0989a95fd80668cfa3fec (diff)
downloadserenity-0e6e1092f0af0c69a639105bc16bd9efcf1ad690.zip
Kernel: Make ptrace return an error on error
Returning 'result.error().code()' erroneously creates an ErrorOr<FlatPtr> of the positive errno code, which breaks our error-returning convention. This seems to be due to a forgotten minus-sign during the refactoring in 9e51e295cfe2775ff179b10f1cd90368cfb102ad. This latent bug was never discovered, because currently the error-handling paths are rarely exercised.
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r--Kernel/Syscalls/ptrace.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/Kernel/Syscalls/ptrace.cpp b/Kernel/Syscalls/ptrace.cpp
index 0eede17a7c..2eb53c3b85 100644
--- a/Kernel/Syscalls/ptrace.cpp
+++ b/Kernel/Syscalls/ptrace.cpp
@@ -162,8 +162,7 @@ ErrorOr<FlatPtr> Process::sys$ptrace(Userspace<const Syscall::SC_ptrace_params*>
REQUIRE_PROMISE(ptrace);
auto params = TRY(copy_typed_from_user(user_params));
- auto result = handle_ptrace(params, *this);
- return result.is_error() ? result.error().code() : result.value();
+ return handle_ptrace(params, *this);
}
/**