@@ -74,7 +74,6 @@ pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Res
7474 let ours;
7575 let mut name;
7676 let mut tries = 0 ;
77- let mut reject_remote_clients_flag = c:: PIPE_REJECT_REMOTE_CLIENTS ;
7877 loop {
7978 tries += 1 ;
8079 name = format ! (
@@ -96,7 +95,7 @@ pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Res
9695 c:: PIPE_TYPE_BYTE
9796 | c:: PIPE_READMODE_BYTE
9897 | c:: PIPE_WAIT
99- | reject_remote_clients_flag ,
98+ | c :: PIPE_REJECT_REMOTE_CLIENTS ,
10099 1 ,
101100 PIPE_BUFFER_CAPACITY ,
102101 PIPE_BUFFER_CAPACITY ,
@@ -112,30 +111,15 @@ pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Res
112111 //
113112 // Don't try again too much though as this could also perhaps be a
114113 // legit error.
115- // If `ERROR_INVALID_PARAMETER` is returned, this probably means we're
116- // running on pre-Vista version where `PIPE_REJECT_REMOTE_CLIENTS` is
117- // not supported, so we continue retrying without it. This implies
118- // reduced security on Windows versions older than Vista by allowing
119- // connections to this pipe from remote machines.
120- // Proper fix would increase the number of FFI imports and introduce
121- // significant amount of Windows XP specific code with no clean
122- // testing strategy
123- // For more info, see https://github.com/rust-lang/rust/pull/37677.
124114 if handle == c:: INVALID_HANDLE_VALUE {
125115 let error = api:: get_last_error ( ) ;
126- if tries < 10 {
127- if error == WinError :: ACCESS_DENIED {
128- continue ;
129- } else if reject_remote_clients_flag != 0
130- && error == WinError :: INVALID_PARAMETER
131- {
132- reject_remote_clients_flag = 0 ;
133- tries -= 1 ;
134- continue ;
135- }
116+ if tries < 10 && error == WinError :: ACCESS_DENIED {
117+ continue ;
118+ } else {
119+ return Err ( io:: Error :: from_raw_os_error ( error. code as i32 ) ) ;
136120 }
137- return Err ( io:: Error :: from_raw_os_error ( error. code as i32 ) ) ;
138121 }
122+
139123 ours = Handle :: from_raw_handle ( handle) ;
140124 break ;
141125 }
0 commit comments