Skip to content

Commit

Permalink
Uses last_os_error to prevent direct access to __error()
Browse files Browse the repository at this point in the history
  • Loading branch information
zonyitoo committed Jan 2, 2020
1 parent 5825f27 commit 353e7fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/relay/tcprelay/utils/tfo/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub async fn bind_listener(addr: &SocketAddr) -> io::Result<TcpListener> {
if ret != 0 {
error!("Failed to listen on {} with TFO enabled, supported after Mac OS X 10.11, iOS 9.0, tvOS 9.0, watchOS 2.0", addr);

return Err(Error::from_raw_os_error(*libc::__error()));
return Err(Error::last_os_error());
}
}

Expand Down Expand Up @@ -75,7 +75,7 @@ pub async fn connect_stream(addr: &SocketAddr) -> io::Result<TcpStream> {
if ret != 0 {
error!("Failed to connect to {} with TFO enabled, supported after Mac OS X 10.11, iOS 9.0, tvOS 9.0, watchOS 2.0", addr);

return Err(Error::from_raw_os_error(*libc::__error()));
return Err(Error::last_os_error());
}
}

Expand Down

0 comments on commit 353e7fc

Please sign in to comment.