From 4895642b888d5c54914d25787c38d2ab338a0460 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Mon, 29 Nov 2021 04:55:58 +0900 Subject: [PATCH] more detailed FFI outputs just to check --- wireguard-control/src/backends/kernel.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wireguard-control/src/backends/kernel.rs b/wireguard-control/src/backends/kernel.rs index 3b2f609..a092f48 100644 --- a/wireguard-control/src/backends/kernel.rs +++ b/wireguard-control/src/backends/kernel.rs @@ -391,12 +391,14 @@ pub fn get_by_name(name: &InterfaceName) -> Result { ) }; + let last_error = io::Error::last_os_error(); + println!("kernel get_by_name: FFI ret code was {}, &device is {:p}, last OS error: {:?}", ret, device, last_error.raw_os_error()); + let result = if ret == 0 && !device.is_null() { println!("kernel get_by_name: wg FFI ret code was normal."); Ok(Device::from(unsafe { &*device })) } else { - let last_error = io::Error::last_os_error(); - println!("kernel get_by_name: FFI ret code was {}, &device is {:p}, last OS error: {:?}", ret, device, last_error.raw_os_error()); + println!("kernel get_by_name: error."); Err(last_error) };