From 169d8a9002f511940758e99ceae2125ca2b727ba Mon Sep 17 00:00:00 2001 From: s1341 Date: Sun, 2 Feb 2025 08:38:08 +0200 Subject: [PATCH] Process: fix imports of frida namespaced glib functions --- frida-gum/src/process.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/frida-gum/src/process.rs b/frida-gum/src/process.rs index 1c3ac55..b428c7f 100644 --- a/frida-gum/src/process.rs +++ b/frida-gum/src/process.rs @@ -131,11 +131,11 @@ impl<'a> Process<'a> { pub fn current_dir(&self) -> String { unsafe { #[cfg(target_os = "linux")] - CStr::from_ptr(_frida_g_get_current_dir()) - .to_string_lossy() - .to_string() + let dir = _frida_g_get_current_dir(); #[cfg(not(target_os = "linux"))] - CStr::from_ptr(_g_get_current_dir()) + let dir = _g_get_current_dir(); + + CStr::from_ptr(dir) .to_string_lossy() .to_string() } @@ -145,11 +145,11 @@ impl<'a> Process<'a> { pub fn tmp_dir(&self) -> String { unsafe { #[cfg(target_os = "linux")] - CStr::from_ptr(_frida_g_get_tmp_dir()) - .to_string_lossy() - .to_string() + let dir = _frida_g_get_tmp_dir(); #[cfg(not(target_os = "linux"))] - CStr::from_ptr(_g_get_tmp_dir()) + let dir = _g_get_tmp_dir(); + + CStr::from_ptr(dir) .to_string_lossy() .to_string() } @@ -159,11 +159,11 @@ impl<'a> Process<'a> { pub fn home_dir(&self) -> String { unsafe { #[cfg(target_os = "linux")] - CStr::from_ptr(_frida_g_get_home_dir()) - .to_string_lossy() - .to_string() + let dir = _frida_g_get_home_dir(); #[cfg(not(target_os = "linux"))] - CStr::from_ptr(_g_get_home_dir()) + let dir = _g_get_home_dir(); + + CStr::from_ptr(dir) .to_string_lossy() .to_string() }