diff options
| author | bors <bors@rust-lang.org> | 2018-01-21 22:38:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-01-21 22:38:29 +0000 |
| commit | ff2a7c85757542f454934e00605355bbca7bc196 (patch) | |
| tree | 9baf95d78fe95a7d6b6424cab8e61c8877fb258a /src/libstd/sys_common | |
| parent | 97520ccb101609af63f29919bb0a39115269c89e (diff) | |
| parent | dcbf0bf5f5f59f936f32d18b729c66f236a974da (diff) | |
Auto merge of #47644 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 9 pull requests - Successful merges: #47247, #47334, #47512, #47582, #47595, #47625, #47632, #47633, #47637 - Failed merges:
Diffstat (limited to 'src/libstd/sys_common')
| -rw-r--r-- | src/libstd/sys_common/net.rs | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/src/libstd/sys_common/net.rs b/src/libstd/sys_common/net.rs index c70b39995eb..b841afe1a51 100644 --- a/src/libstd/sys_common/net.rs +++ b/src/libstd/sys_common/net.rs @@ -166,27 +166,9 @@ pub fn lookup_host(host: &str) -> io::Result<LookupHost> { hints.ai_socktype = c::SOCK_STREAM; let mut res = ptr::null_mut(); unsafe { - match cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), &hints, &mut res)) { - Ok(_) => { - Ok(LookupHost { original: res, cur: res }) - }, - #[cfg(unix)] - Err(e) => { - // If we're running glibc prior to version 2.26, the lookup - // failure could be caused by caching a stale /etc/resolv.conf. - // We need to call libc::res_init() to clear the cache. But we - // shouldn't call it in on any other platform, because other - // res_init implementations aren't thread-safe. See - // https://github.com/rust-lang/rust/issues/41570 and - // https://github.com/rust-lang/rust/issues/43592. - use sys::net::res_init_if_glibc_before_2_26; - let _ = res_init_if_glibc_before_2_26(); - Err(e) - }, - // the cfg is needed here to avoid an "unreachable pattern" warning - #[cfg(not(unix))] - Err(e) => Err(e), - } + cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), &hints, &mut res)).map(|_| { + LookupHost { original: res, cur: res } + }) } } |
