summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-06 04:30:51 +0000
committerbors <bors@rust-lang.org>2019-12-06 04:30:51 +0000
commit7b482cdf7ce55e05ee8392e1ade70966e3189cfd (patch)
tree66805c0df7473a40d093342cde3b12a5bcc9b097
parentAuto merge of #66911 - eddyb:nicer-rustc_regions, r=matthewjasper (diff)
parentadded correct error code for WSASocketW failure fallback (diff)
downloadrust-7b482cdf7ce55e05ee8392e1ade70966e3189cfd.tar.gz
rust-7b482cdf7ce55e05ee8392e1ade70966e3189cfd.tar.bz2
rust-7b482cdf7ce55e05ee8392e1ade70966e3189cfd.tar.xz
Auto merge of #66835 - AviKozokin:master, r=alexcrichton
std:win: avoid WSA_FLAG_NO_INHERIT flag and don't use SetHandleInformation on UWP This flag is not supported on Windows 7 before SP1, and on windows server 2008 SP2. This breaks Socket creation & duplication. This was fixed in a previous PR. cc #26658 This PR: cc #60260 reuses this flag to support UWP, and makes an attempt to handle the potential error. This version still fails to create a socket, as the error returned by WSA on this case is WSAEINVAL (invalid argument). and not WSAEPROTOTYPE. MSDN page for WSASocketW (that states the platform support for WSA_FLAG_NO_HANDLE_INHERIT): https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw CC #26543 CC #26518
-rw-r--r--src/libstd/sys/windows/net.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/sys/windows/net.rs b/src/libstd/sys/windows/net.rs
index 32f4011..2f2f285 100644
--- a/src/libstd/sys/windows/net.rs
+++ b/src/libstd/sys/windows/net.rs
@@ -100,7 +100,7 @@ impl Socket {
100 c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT) { 100 c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT) {
101 c::INVALID_SOCKET => { 101 c::INVALID_SOCKET => {
102 match c::WSAGetLastError() { 102 match c::WSAGetLastError() {
103 c::WSAEPROTOTYPE => { 103 c::WSAEPROTOTYPE | c::WSAEINVAL => {
104 match c::WSASocketW(fam, ty, 0, ptr::null_mut(), 0, 104 match c::WSASocketW(fam, ty, 0, ptr::null_mut(), 0,
105 c::WSA_FLAG_OVERLAPPED) { 105 c::WSA_FLAG_OVERLAPPED) {
106 c::INVALID_SOCKET => Err(last_error()), 106 c::INVALID_SOCKET => Err(last_error()),
@@ -199,7 +199,7 @@ impl Socket {
199 c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT) { 199 c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT) {
200 c::INVALID_SOCKET => { 200 c::INVALID_SOCKET => {
201 match c::WSAGetLastError() { 201 match c::WSAGetLastError() {
202 c::WSAEPROTOTYPE => { 202 c::WSAEPROTOTYPE | c::WSAEINVAL => {
203 match c::WSASocketW(info.iAddressFamily, 203 match c::WSASocketW(info.iAddressFamily,
204 info.iSocketType, 204 info.iSocketType,
205 info.iProtocol, 205 info.iProtocol,