mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-05 03:20:46 -05:00
Update to ONDK r29.5
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
#![feature(try_blocks)]
|
||||
#![allow(clippy::missing_safety_doc)]
|
||||
|
||||
use logging::setup_klog;
|
||||
|
||||
@@ -17,7 +17,7 @@ unsafe extern "C" {
|
||||
}
|
||||
|
||||
pub(crate) fn switch_root(path: &Utf8CStr) {
|
||||
let res: LoggedResult<()> = try {
|
||||
|| -> LoggedResult<()> {
|
||||
debug!("Switch root to {}", path);
|
||||
let mut mounts = BTreeSet::new();
|
||||
let rootfs = Directory::open(cstr!("/"))?;
|
||||
@@ -48,8 +48,9 @@ pub(crate) fn switch_root(path: &Utf8CStr) {
|
||||
|
||||
debug!("Cleaning rootfs");
|
||||
rootfs.remove_all()?;
|
||||
};
|
||||
res.ok();
|
||||
Ok(())
|
||||
}()
|
||||
.ok();
|
||||
}
|
||||
|
||||
pub(crate) fn is_device_mounted(dev: u64, target: Pin<&mut CxxString>) -> bool {
|
||||
|
||||
@@ -28,7 +28,7 @@ pub(crate) fn hexpatch_init_for_second_stage(writable: bool) {
|
||||
// If we cannot directly modify /init, we need to bind mount a replacement on top of it
|
||||
let src = cstr!("/init");
|
||||
let dest = cstr!("/data/init");
|
||||
let _: LoggedResult<()> = try {
|
||||
let _ = || -> LoggedResult<()> {
|
||||
{
|
||||
let mut fd = dest.create(OFlag::O_CREAT | OFlag::O_WRONLY, 0)?;
|
||||
fd.write_all(init.as_ref())?;
|
||||
@@ -36,7 +36,8 @@ pub(crate) fn hexpatch_init_for_second_stage(writable: bool) {
|
||||
let attr = src.follow_link().get_attr()?;
|
||||
dest.set_attr(&attr)?;
|
||||
dest.bind_mount_to(src, false)?;
|
||||
};
|
||||
Ok(())
|
||||
}();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user