File tree 1 file changed +19
-10
lines changed
library/std/src/sys/pal/unix
1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -213,16 +213,25 @@ impl Socket {
213
213
}
214
214
0 => { }
215
215
_ => {
216
- // linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look
217
- // for POLLHUP rather than read readiness
218
- if pollfd. revents & libc:: POLLHUP != 0 {
219
- let e = self . take_error ( ) ?. unwrap_or_else ( || {
220
- io:: const_io_error!(
221
- io:: ErrorKind :: Uncategorized ,
222
- "no error set after POLLHUP" ,
223
- )
224
- } ) ;
225
- return Err ( e) ;
216
+ if cfg ! ( target_os = "vxworks" ) {
217
+ // Check if the connnection actually succeeded and return ok only when
218
+ // the socket is ready and no errors were found
219
+ // https://github.com/rust-lang/rust/issues/127018
220
+ if let Some ( e) = self . take_error ( ) ? {
221
+ return Err ( e) ;
222
+ }
223
+ } else {
224
+ // linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look
225
+ // for POLLHUP rather than read readiness
226
+ if pollfd. revents & libc:: POLLHUP != 0 {
227
+ let e = self . take_error ( ) ?. unwrap_or_else ( || {
228
+ io:: const_io_error!(
229
+ io:: ErrorKind :: Uncategorized ,
230
+ "no error set after POLLHUP" ,
231
+ )
232
+ } ) ;
233
+ return Err ( e) ;
234
+ }
226
235
}
227
236
228
237
return Ok ( ( ) ) ;
You can’t perform that action at this time.
0 commit comments