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
@@ -1,6 +1,6 @@
use crate::consts::{ROOTMNT, ROOTOVL};
use crate::ffi::MagiskInit;
use base::libc::{O_CREAT, O_RDONLY, O_WRONLY};
use base::nix::fcntl::OFlag;
use base::{
BufReadExt, Directory, FsPathBuilder, LoggedResult, ResultExt, Utf8CStr, Utf8CString,
clone_attr, cstr, debug,
@@ -44,7 +44,7 @@ pub struct OverlayAttr(Utf8CString, Utf8CString);
impl MagiskInit {
pub(crate) fn parse_config_file(&mut self) {
if let Ok(fd) = cstr!("/data/.backup/.magisk").open(O_RDONLY) {
if let Ok(fd) = cstr!("/data/.backup/.magisk").open(OFlag::O_RDONLY) {
let mut reader = BufReader::new(fd);
reader.for_each_prop(|key, val| {
if key == "PREINITDEVICE" {
@@ -95,7 +95,7 @@ impl MagiskInit {
let mut mount_list = String::new();
self.mount_impl(cstr!(ROOTOVL), dest, &mut mount_list)
.log_ok();
if let Ok(mut fd) = cstr!(ROOTMNT).create(O_CREAT | O_WRONLY, 0) {
if let Ok(mut fd) = cstr!(ROOTMNT).create(OFlag::O_CREAT | OFlag::O_WRONLY, 0) {
fd.write(mount_list.as_bytes()).log_ok();
}
}