Revert "Fix #27: bool on kernel is 4 bytes, while rust's is 1 byte. This causes the stack to be covered, triggering a ub."

This reverts commit 7c27c32861.
This commit is contained in:
Nullptr
2023-06-18 15:47:12 +08:00
parent 7c27c32861
commit 99e653c576

View File

@@ -25,13 +25,13 @@ pub fn get_kernel_su() -> Option<Version> {
}
pub fn uid_granted_root(uid: i32) -> bool {
let mut granted = 0;
unsafe { prctl(KERNEL_SU_OPTION, CMD_UID_GRANTED_ROOT, uid, &mut granted as *mut i32) };
granted == 1
let mut granted = false;
unsafe { prctl(KERNEL_SU_OPTION, CMD_UID_GRANTED_ROOT, uid, &mut granted as *mut bool) };
granted
}
pub fn uid_should_umount(uid: i32) -> bool {
let mut umount = 0;
unsafe { prctl(KERNEL_SU_OPTION, CMD_UID_SHOULD_UMOUNT, uid, &mut umount as *mut i32) };
umount == 1
let mut umount = false;
unsafe { prctl(KERNEL_SU_OPTION, CMD_UID_SHOULD_UMOUNT, uid, &mut umount as *mut bool) };
umount
}