You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Provide richer error messages
Make sure most syscall/libc calls results are mapped to OsResult that can produce more detailed error messages.
This commit is contained in:
@@ -130,7 +130,7 @@ impl MagiskInit {
|
||||
null(),
|
||||
)
|
||||
}
|
||||
.as_os_err()?;
|
||||
.check_io_err()?;
|
||||
self.mount_list.push("/proc".to_string());
|
||||
}
|
||||
if !path!("/sys/block").exists() {
|
||||
@@ -144,7 +144,7 @@ impl MagiskInit {
|
||||
null(),
|
||||
)
|
||||
}
|
||||
.as_os_err()?;
|
||||
.check_io_err()?;
|
||||
self.mount_list.push("/sys".to_string());
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ pub(crate) fn switch_root(path: &Utf8CStr) {
|
||||
mounts.insert(info.target);
|
||||
}
|
||||
unsafe {
|
||||
chdir(path.as_ptr()).as_os_err()?;
|
||||
chdir(path.as_ptr()).check_io_err()?;
|
||||
FsPath::from(path).move_mount_to(path!("/"))?;
|
||||
chroot(raw_cstr!("."));
|
||||
}
|
||||
@@ -89,7 +89,7 @@ impl MagiskInit {
|
||||
raw_cstr!("mode=755").cast(),
|
||||
)
|
||||
}
|
||||
.as_os_err()
|
||||
.check_io_err()
|
||||
.log_ok();
|
||||
|
||||
path!("/init").copy_to(path!("/data/magiskinit")).log_ok();
|
||||
@@ -108,7 +108,7 @@ impl MagiskInit {
|
||||
}
|
||||
unsafe {
|
||||
execve(raw_cstr!("/init"), self.argv.cast(), environ.cast())
|
||||
.as_os_err()
|
||||
.check_io_err()
|
||||
.log_ok();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ impl MagiskInit {
|
||||
0,
|
||||
ptr::null(),
|
||||
)
|
||||
.as_os_err()?;
|
||||
.check_io_err()?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ impl MagiskInit {
|
||||
}
|
||||
|
||||
// Create a new process waiting for init operations
|
||||
let pid = unsafe { libc::fork().check_os_err()? };
|
||||
let pid = unsafe { libc::fork() };
|
||||
if pid != 0 {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user