Kernel: Store socket errors as errno codes rather than ErrorOr values

This commit is contained in:
Timothy Flynn 2023-02-09 12:57:19 -05:00 committed by Linus Groh
parent d32961777b
commit bd4bddf31b
Notes: sideshowbarker 2024-07-17 20:19:08 +09:00
2 changed files with 11 additions and 11 deletions

View file

@ -169,11 +169,9 @@ ErrorOr<void> Socket::getsockopt(OpenFileDescription&, int level, int option, Us
case SO_ERROR: {
if (size < sizeof(int))
return EINVAL;
int errno;
if (so_error().is_error())
errno = so_error().error().code();
else
errno = 0;
int errno = 0;
if (auto const& error = so_error(); error.has_value())
errno = error.value();
TRY(copy_to_user(static_ptr_cast<int*>(value), &errno));
size = sizeof(int);
TRY(copy_to_user(value_size, &size));