mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
Kernel: Properly implement SO_ERROR option
This fixes the placeholder stub for the SO_ERROR via getsockopt. It leverages the m_so_error value that each socket maintains. The SO_ERROR option obtains and then clears this field, which is useful when checking for errors that occur between socket calls. This uses an integer value to return the SO_ERROR status. Resolves #146
This commit is contained in:
@@ -181,14 +181,13 @@ KResult Socket::getsockopt(FileDescription&, int level, int option, Userspace<vo
|
||||
case SO_ERROR: {
|
||||
if (size < sizeof(int))
|
||||
return EINVAL;
|
||||
dbgln("getsockopt(SO_ERROR): FIXME!");
|
||||
int errno = 0;
|
||||
int errno = so_error().error();
|
||||
if (!copy_to_user(static_ptr_cast<int*>(value), &errno))
|
||||
return EFAULT;
|
||||
size = sizeof(int);
|
||||
if (!copy_to_user(value_size, &size))
|
||||
return EFAULT;
|
||||
return KSuccess;
|
||||
return set_so_error(KSuccess);
|
||||
}
|
||||
case SO_BINDTODEVICE:
|
||||
if (size < IFNAMSIZ)
|
||||
|
||||
Reference in New Issue
Block a user