1
Fork 0

When getaddrinfo returns EAI_SYSTEM retrieve actual error from errno.

Fixes issue #36546. This change also updates libc to earliest version
that includes EAI_SYSTEM constant.
This commit is contained in:
Tomasz Miąsko 2016-09-25 00:00:00 +02:00
parent 3bf4a7ad45
commit c52b957b89
2 changed files with 8 additions and 3 deletions

@ -1 +1 @@
Subproject commit d4f6a19c55a03e3f9f6fb7377911b37ed807eb6c
Subproject commit eb708c020826a8d792a5a5275be147aabe47fe24

View file

@ -10,7 +10,7 @@
use ffi::CStr;
use io;
use libc::{self, c_int, size_t, sockaddr, socklen_t};
use libc::{self, c_int, size_t, sockaddr, socklen_t, EAI_SYSTEM};
use net::{SocketAddr, Shutdown};
use str;
use sys::fd::FileDesc;
@ -38,7 +38,12 @@ pub struct Socket(FileDesc);
pub fn init() {}
pub fn cvt_gai(err: c_int) -> io::Result<()> {
if err == 0 { return Ok(()) }
if err == 0 {
return Ok(())
}
if err == EAI_SYSTEM {
return Err(io::Error::last_os_error())
}
let detail = unsafe {
str::from_utf8(CStr::from_ptr(libc::gai_strerror(err)).to_bytes()).unwrap()