addrinfo hint in lookup_host() needs clean initialization on all platforms
Fixes #43649
This commit is contained in:
Submodule src/liblibc updated: ec1e5ab1ef...2a5b50b7f7
@@ -165,16 +165,8 @@ pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
|
|||||||
init();
|
init();
|
||||||
|
|
||||||
let c_host = CString::new(host)?;
|
let c_host = CString::new(host)?;
|
||||||
let hints = c::addrinfo {
|
let mut hints: c::addrinfo = unsafe { mem::zeroed() };
|
||||||
ai_flags: 0,
|
hints.ai_socktype = c::SOCK_STREAM;
|
||||||
ai_family: 0,
|
|
||||||
ai_socktype: c::SOCK_STREAM,
|
|
||||||
ai_protocol: 0,
|
|
||||||
ai_addrlen: 0,
|
|
||||||
ai_addr: ptr::null_mut(),
|
|
||||||
ai_canonname: ptr::null_mut(),
|
|
||||||
ai_next: ptr::null_mut()
|
|
||||||
};
|
|
||||||
let mut res = ptr::null_mut();
|
let mut res = ptr::null_mut();
|
||||||
unsafe {
|
unsafe {
|
||||||
match cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), &hints, &mut res)) {
|
match cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), &hints, &mut res)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user