ksud: fix compile err in x86_64
This commit is contained in:
@@ -161,11 +161,15 @@ pub fn root_shell() -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut uid = 0; // default uid = 0(root)
|
let mut uid = 0; // default uid = 0(root)
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
|
||||||
if free_idx < matches.free.len() {
|
if free_idx < matches.free.len() {
|
||||||
let name = &matches.free[free_idx];
|
let name = &matches.free[free_idx];
|
||||||
uid = unsafe {
|
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,
|
Some(pw) => pw.pw_uid,
|
||||||
None => name.parse::<u32>().unwrap_or(0),
|
None => name.parse::<u32>().unwrap_or(0),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user