From aa7846c1c099f7394b2f867827c0620c65626ad5 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Tue, 4 Apr 2023 10:41:20 +0800 Subject: [PATCH] No need to mount ROOTMIR if tmp_dir != /sbin --- native/src/init/rootdir.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/native/src/init/rootdir.cpp b/native/src/init/rootdir.cpp index a7e1211d5..ba1637c5b 100644 --- a/native/src/init/rootdir.cpp +++ b/native/src/init/rootdir.cpp @@ -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);