From 353e7fc605a977e723e302bf1d44b50110f6aa5e Mon Sep 17 00:00:00 2001 From: zonyitoo Date: Thu, 2 Jan 2020 21:34:50 +0800 Subject: [PATCH] Uses last_os_error to prevent direct access to __error() --- src/relay/tcprelay/utils/tfo/macos.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/relay/tcprelay/utils/tfo/macos.rs b/src/relay/tcprelay/utils/tfo/macos.rs index 5e018821a6fb..a7c58883008d 100644 --- a/src/relay/tcprelay/utils/tfo/macos.rs +++ b/src/relay/tcprelay/utils/tfo/macos.rs @@ -35,7 +35,7 @@ pub async fn bind_listener(addr: &SocketAddr) -> io::Result { 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()); } } @@ -75,7 +75,7 @@ pub async fn connect_stream(addr: &SocketAddr) -> io::Result { 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()); } }