From 006253170a4372b7bd97e821501e62ee312e37e6 Mon Sep 17 00:00:00 2001 From: Jackson Coxson Date: Sun, 30 Mar 2025 16:15:27 -0600 Subject: [PATCH] Use reference of log file string instead of take ownership [FFI] --- ffi/src/logging.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ffi/src/logging.rs b/ffi/src/logging.rs index 404d873..3b93159 100644 --- a/ffi/src/logging.rs +++ b/ffi/src/logging.rs @@ -1,7 +1,7 @@ // Jackson Coxson use std::{ - ffi::{CString, c_char}, + ffi::{CStr, CString, c_char}, fs::File, }; @@ -46,7 +46,7 @@ pub unsafe extern "C" fn idevice_init_logger( )); if !file_path.is_null() { - let file_path = match unsafe { CString::from_raw(file_path) }.to_str() { + let file_path = match unsafe { CStr::from_ptr(file_path) }.to_str() { Ok(f) => f.to_string(), Err(_) => { return IdeviceLoggerError::InvalidPathString;