more detailed FFI outputs just to check

ffi-segfault-fix
Jake McGinty 2021-11-29 04:55:58 +09:00
parent f3a100d44b
commit 4895642b88
1 changed files with 4 additions and 2 deletions

View File

@ -391,12 +391,14 @@ pub fn get_by_name(name: &InterfaceName) -> Result<Device, io::Error> {
) )
}; };
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() { let result = if ret == 0 && !device.is_null() {
println!("kernel get_by_name: wg FFI ret code was normal."); println!("kernel get_by_name: wg FFI ret code was normal.");
Ok(Device::from(unsafe { &*device })) Ok(Device::from(unsafe { &*device }))
} else { } else {
let last_error = io::Error::last_os_error(); println!("kernel get_by_name: error.");
println!("kernel get_by_name: FFI ret code was {}, &device is {:p}, last OS error: {:?}", ret, device, last_error.raw_os_error());
Err(last_error) Err(last_error)
}; };