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
9e51e295cf. This latent bug was never
discovered, because currently the error-handling paths are rarely
exercised.
This commit is contained in:
Ben Wiederhake 2021-11-27 11:22:25 +01:00 committed by Andreas Kling
parent 49adebf0fc
commit 0e6e1092f0
Notes: sideshowbarker 2024-07-17 23:07:38 +09:00

View file

@ -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);
}
/**