File tree 1 file changed +20
-10
lines changed
library/std/src/sys/pal/unix
1 file changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -213,16 +213,26 @@ 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
+ }
224
+ else {
225
+ // linux returns POLLOUT|POLLERR|POLLHUP for refused connections (!), so look
226
+ // for POLLHUP rather than read readiness
227
+ if pollfd. revents & libc:: POLLHUP != 0 {
228
+ let e = self . take_error ( ) ?. unwrap_or_else ( || {
229
+ io:: const_io_error!(
230
+ io:: ErrorKind :: Uncategorized ,
231
+ "no error set after POLLHUP" ,
232
+ )
233
+ } ) ;
234
+ return Err ( e) ;
235
+ }
226
236
}
227
237
228
238
return Ok ( ( ) ) ;
You can’t perform that action at this time.
0 commit comments