mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-30 14:34:28 +02:00
Fix 2SI on legacy SAR devices
This commit is contained in:
parent
a396abf565
commit
0bbfe7f44d
@ -1,11 +1,11 @@
|
|||||||
use crate::ffi::MagiskInit;
|
use crate::ffi::MagiskInit;
|
||||||
use base::{
|
use base::{
|
||||||
clone_attr, cstr, debug, error, info,
|
LibcReturn, LoggedResult, MappedFile, MutBytesExt, ResultExt, cstr, debug, error, info,
|
||||||
libc::{
|
libc::{
|
||||||
mount, statfs, umount2, MNT_DETACH, MS_BIND, O_CLOEXEC,
|
MNT_DETACH, MS_BIND, O_CLOEXEC, O_CREAT, O_RDONLY, O_WRONLY, TMPFS_MAGIC, mount, statfs,
|
||||||
O_CREAT, O_RDONLY, O_WRONLY, TMPFS_MAGIC,
|
umount2,
|
||||||
},
|
},
|
||||||
path, raw_cstr, LibcReturn, MappedFile, MutBytesExt, ResultExt,
|
path, raw_cstr,
|
||||||
};
|
};
|
||||||
use std::{ffi::c_long, io::Write, ptr::null};
|
use std::{ffi::c_long, io::Write, ptr::null};
|
||||||
|
|
||||||
@ -113,12 +113,13 @@ impl MagiskInit {
|
|||||||
error!("Failed to open {} for hexpatch", src);
|
error!("Failed to open {} for hexpatch", src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clone_attr(src, dest).log_ok();
|
let _: LoggedResult<()> = try {
|
||||||
unsafe {
|
let attr = src.follow_link().get_attr()?;
|
||||||
mount(dest.as_ptr(), src.as_ptr(), null(), MS_BIND, null())
|
dest.set_attr(&attr)?;
|
||||||
.as_os_err()
|
unsafe {
|
||||||
.ok();
|
mount(dest.as_ptr(), src.as_ptr(), null(), MS_BIND, null()).as_os_err()?;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn second_stage(&mut self) {
|
pub(crate) fn second_stage(&mut self) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user