Remove assertion on output length for getsockopt.

POSIX allows `getsockopt` to set `*option_len` to a smaller value if
necessary. Windows will set `*option_len` to 1 for boolean options even
when the caller passes a `BOOL` (`int`) with `*option_len` as 4.
This commit is contained in:
Chris Copeland 2022-02-19 12:08:06 -08:00
parent 3eb983ed99
commit f2ebd0a11f
No known key found for this signature in database
GPG Key ID: 14550DA72485DF30

View File

@ -87,7 +87,6 @@ pub fn getsockopt<T: Copy>(sock: &Socket, level: c_int, option_name: c_int) -> i
&mut option_value as *mut T as *mut _,
&mut option_len,
))?;
assert_eq!(option_len as usize, mem::size_of::<T>());
Ok(option_value)
}
}