Replace rust inner functions to try blocks

This commit is contained in:
LoveSy
2025-02-01 22:27:36 +08:00
committed by John Wu
parent 88628fdf3c
commit 3981c9665e
12 changed files with 99 additions and 116 deletions

View File

@@ -106,11 +106,7 @@ pub fn clean_mounts() {
let module_mnt = FsPathBuf::new(&mut buf).join(magisk_tmp).join(MODULEMNT);
let _: LoggedResult<()> = try {
unsafe {
libc::umount2(
module_mnt.as_ptr(),
libc::MNT_DETACH,
)
.as_os_err()?;
libc::umount2(module_mnt.as_ptr(), libc::MNT_DETACH).as_os_err()?;
}
};
@@ -125,11 +121,7 @@ pub fn clean_mounts() {
ptr::null(),
)
.as_os_err()?;
libc::umount2(
worker_dir.as_ptr(),
libc::MNT_DETACH,
)
.as_os_err()?;
libc::umount2(worker_dir.as_ptr(), libc::MNT_DETACH).as_os_err()?;
}
};
}