Use nix for libc functions

This commit is contained in:
topjohnwu
2025-09-08 23:59:29 -07:00
parent 17082af438
commit ef4e230258
31 changed files with 457 additions and 475 deletions
+3 -3
View File
@@ -44,7 +44,7 @@ pub(crate) fn switch_root(path: &Utf8CStr) {
mounts.insert(info.target);
}
unsafe {
chdir(path.as_ptr()).check_io_err()?;
chdir(path.as_ptr()).check_err()?;
path.move_mount_to(cstr!("/"))?;
chroot(raw_cstr!("."));
}
@@ -88,7 +88,7 @@ impl MagiskInit {
raw_cstr!("mode=755").cast(),
)
}
.check_io_err()
.check_err()
.log_ok();
cstr!("/init").copy_to(cstr!("/data/magiskinit")).log_ok();
@@ -107,7 +107,7 @@ impl MagiskInit {
}
unsafe {
execve(raw_cstr!("/init"), self.argv.cast(), environ.cast())
.check_io_err()
.check_err()
.log_ok();
exit(1);
}