From fa8b54901f1236cbcd48205856e8766496664105 Mon Sep 17 00:00:00 2001 From: avikozokin Date: Mon, 2 Dec 2019 20:12:51 +0200 Subject: [PATCH] added correct error code for WSASocketW failure fallback --- src/libstd/sys/windows/net.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/sys/windows/net.rs b/src/libstd/sys/windows/net.rs index 32f4011fb32..2f2f285edc1 100644 --- a/src/libstd/sys/windows/net.rs +++ b/src/libstd/sys/windows/net.rs @@ -100,7 +100,7 @@ pub fn new(addr: &SocketAddr, ty: c_int) -> io::Result { c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT) { c::INVALID_SOCKET => { match c::WSAGetLastError() { - c::WSAEPROTOTYPE => { + c::WSAEPROTOTYPE | c::WSAEINVAL => { match c::WSASocketW(fam, ty, 0, ptr::null_mut(), 0, c::WSA_FLAG_OVERLAPPED) { c::INVALID_SOCKET => Err(last_error()), @@ -199,7 +199,7 @@ pub fn duplicate(&self) -> io::Result { c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT) { c::INVALID_SOCKET => { match c::WSAGetLastError() { - c::WSAEPROTOTYPE => { + c::WSAEPROTOTYPE | c::WSAEINVAL => { match c::WSASocketW(info.iAddressFamily, info.iSocketType, info.iProtocol,