mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
New magisk tmp dir: /debug_ramdisk
Co-authored-by: LoveSy <shana@zju.edu.cn>
This commit is contained in:
parent
ee50da566f
commit
f9d22cf8ee
@ -215,10 +215,9 @@ void MagiskInit::patch_ro_root() {
|
|||||||
if (access("/sbin", F_OK) == 0) {
|
if (access("/sbin", F_OK) == 0) {
|
||||||
tmp_dir = "/sbin";
|
tmp_dir = "/sbin";
|
||||||
} else {
|
} else {
|
||||||
char buf[16];
|
tmp_dir = "/debug_ramdisk";
|
||||||
gen_rand_str(buf, sizeof(buf));
|
xmkdir("/data/debug_ramdisk", 0);
|
||||||
tmp_dir = "/dev/"s + buf;
|
xmount("/debug_ramdisk", "/data/debug_ramdisk", nullptr, MS_MOVE, nullptr);
|
||||||
xmkdir(tmp_dir.data(), 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_tmp(tmp_dir.data());
|
setup_tmp(tmp_dir.data());
|
||||||
@ -230,6 +229,10 @@ void MagiskInit::patch_ro_root() {
|
|||||||
xmount("/", ROOTMIR, nullptr, MS_BIND, nullptr);
|
xmount("/", ROOTMIR, nullptr, MS_BIND, nullptr);
|
||||||
recreate_sbin(ROOTMIR "/sbin", true);
|
recreate_sbin(ROOTMIR "/sbin", true);
|
||||||
xumount2(ROOTMIR, MNT_DETACH);
|
xumount2(ROOTMIR, MNT_DETACH);
|
||||||
|
} else {
|
||||||
|
// Restore debug_ramdisk
|
||||||
|
xmount("/data/debug_ramdisk", "/debug_ramdisk", nullptr, MS_MOVE, nullptr);
|
||||||
|
rmdir("/data/debug_ramdisk");
|
||||||
}
|
}
|
||||||
|
|
||||||
xrename("overlay.d", ROOTOVL);
|
xrename("overlay.d", ROOTOVL);
|
||||||
|
Loading…
Reference in New Issue
Block a user