mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
Use reference of log file string instead of take ownership [FFI]
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// Jackson Coxson
|
// Jackson Coxson
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
ffi::{CString, c_char},
|
ffi::{CStr, CString, c_char},
|
||||||
fs::File,
|
fs::File,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ pub unsafe extern "C" fn idevice_init_logger(
|
|||||||
));
|
));
|
||||||
|
|
||||||
if !file_path.is_null() {
|
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(),
|
Ok(f) => f.to_string(),
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return IdeviceLoggerError::InvalidPathString;
|
return IdeviceLoggerError::InvalidPathString;
|
||||||
|
|||||||
Reference in New Issue
Block a user