mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-05 23:14:03 -05:00
Make FsPathBuf a trait and rename to FsPathBuilder
This commit is contained in:
+15
-13
@@ -4,8 +4,8 @@ use crate::ffi::{DbEntryKey, get_magisk_tmp, install_apk, uninstall_pkg};
|
||||
use base::WalkResult::{Abort, Continue, Skip};
|
||||
use base::libc::{O_CLOEXEC, O_CREAT, O_RDONLY, O_TRUNC, O_WRONLY};
|
||||
use base::{
|
||||
BufReadExt, Directory, FsPath, FsPathBuf, LoggedResult, ReadExt, ResultExt, Utf8CStrBuf, cstr,
|
||||
cstr_buf, error, fd_get_attr, open_fd, warn,
|
||||
BufReadExt, Directory, FsPath, FsPathBuilder, LoggedResult, ReadExt, ResultExt, Utf8CStrBuf,
|
||||
cstr, cstr_buf, error, fd_get_attr, open_fd, warn,
|
||||
};
|
||||
use bit_set::BitSet;
|
||||
use cxx::CxxString;
|
||||
@@ -239,12 +239,12 @@ impl TrackedFile {
|
||||
|
||||
impl ManagerInfo {
|
||||
fn check_dyn(&mut self, daemon: &MagiskD, user: i32, pkg: &str) -> Status {
|
||||
let apk = FsPathBuf::default()
|
||||
.join(daemon.app_data_dir())
|
||||
.join_fmt(user)
|
||||
.join(pkg)
|
||||
.join("dyn")
|
||||
.join("current.apk");
|
||||
let apk = cstr_buf::default()
|
||||
.join_path(daemon.app_data_dir())
|
||||
.join_path_fmt(user)
|
||||
.join_path(pkg)
|
||||
.join_path("dyn")
|
||||
.join_path("current.apk");
|
||||
let uid: i32;
|
||||
let cert = match apk.open(O_RDONLY | O_CLOEXEC) {
|
||||
Ok(mut fd) => {
|
||||
@@ -441,10 +441,10 @@ impl ManagerInfo {
|
||||
|
||||
impl MagiskD {
|
||||
fn get_package_uid(&self, user: i32, pkg: &str) -> i32 {
|
||||
let path = FsPathBuf::default()
|
||||
.join(self.app_data_dir())
|
||||
.join_fmt(user)
|
||||
.join(pkg);
|
||||
let path = cstr_buf::default()
|
||||
.join_path(self.app_data_dir())
|
||||
.join_path_fmt(user)
|
||||
.join_path(pkg);
|
||||
path.get_attr()
|
||||
.map(|attr| attr.st.st_uid as i32)
|
||||
.unwrap_or(-1)
|
||||
@@ -453,7 +453,9 @@ impl MagiskD {
|
||||
pub fn preserve_stub_apk(&self) {
|
||||
let mut info = self.manager_info.lock().unwrap();
|
||||
|
||||
let apk = FsPathBuf::default().join(get_magisk_tmp()).join("stub.apk");
|
||||
let apk = cstr_buf::default()
|
||||
.join_path(get_magisk_tmp())
|
||||
.join_path("stub.apk");
|
||||
|
||||
if let Ok(mut fd) = apk.open(O_RDONLY | O_CLOEXEC) {
|
||||
info.trusted_cert = read_certificate(&mut fd, MAGISK_VER_CODE);
|
||||
|
||||
Reference in New Issue
Block a user