Stub for SO_ERROR to fix curl

This commit is contained in:
Jeremy Soller
2020-01-21 20:29:26 -07:00
parent 2e5d4a4d25
commit 9a449d4f6c
+22
View File
@@ -145,6 +145,28 @@ impl PalSocket for Sys {
option_value: *mut c_void,
option_len: *mut socklen_t,
) -> c_int {
match level {
SOL_SOCKET => match option_name {
SO_ERROR => {
if option_value.is_null() {
return e(Err(syscall::Error::new(syscall::EFAULT))) as c_int;
}
if (option_len as usize) < mem::size_of::<c_int>() {
return e(Err(syscall::Error::new(syscall::EINVAL))) as c_int;
}
let error = unsafe { &mut *(option_value as *mut c_int) };
//TODO: Socket nonblock connection error
*error = 0;
return 0;
},
_ => (),
},
_ => (),
}
eprintln!(
"getsockopt({}, {}, {}, {:p}, {:p})",
socket, level, option_name, option_value, option_len