1
mirror of https://github.com/topjohnwu/Magisk synced 2024-11-16 00:13:57 +01:00

No need to mount ROOTMIR if tmp_dir != /sbin

This commit is contained in:
LoveSy 2023-04-04 10:41:20 +08:00 committed by John Wu
parent 24ba4ab95b
commit aa7846c1c0

View File

@ -233,14 +233,14 @@ void MagiskInit::patch_ro_root() {
setup_tmp(tmp_dir.data());
chdir(tmp_dir.data());
// Mount system_root mirror
xmkdir(ROOTMIR, 0755);
xmount("/", ROOTMIR, nullptr, MS_BIND, nullptr);
mount_list.emplace_back(tmp_dir + "/" ROOTMIR);
// Recreate original sbin structure if necessary
if (tmp_dir == "/sbin")
if (tmp_dir == "/sbin") {
// Mount system_root mirror
xmkdir(ROOTMIR, 0755);
xmount("/", ROOTMIR, nullptr, MS_BIND, nullptr);
recreate_sbin(ROOTMIR "/sbin", true);
xumount2(ROOTMIR, MNT_DETACH);
}
xrename("overlay.d", ROOTOVL);