diff --git a/userspace/ksud/src/ksu.rs b/userspace/ksud/src/ksu.rs index fafe72f8..0235b59a 100644 --- a/userspace/ksud/src/ksu.rs +++ b/userspace/ksud/src/ksu.rs @@ -161,11 +161,15 @@ pub fn root_shell() -> Result<()> { } let mut uid = 0; // default uid = 0(root) - #[cfg(any(target_os = "linux", target_os = "android"))] if free_idx < matches.free.len() { let name = &matches.free[free_idx]; uid = unsafe { - match libc::getpwnam(name.as_ptr() as *const u8).as_ref() { + #[cfg(target_arch = "aarch64")] + let pw = libc::getpwnam(name.as_ptr() as *const u8).as_ref(); + #[cfg(target_arch = "x86_64")] + let pw = libc::getpwnam(name.as_ptr() as *const i8).as_ref(); + + match pw { Some(pw) => pw.pw_uid, None => name.parse::().unwrap_or(0), }