diff --git a/native/src/zygisk/deny/revert.cpp b/native/src/zygisk/deny/revert.cpp index 05ac97786..47ccd7634 100644 --- a/native/src/zygisk/deny/revert.cpp +++ b/native/src/zygisk/deny/revert.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -13,14 +14,24 @@ static void lazy_unmount(const char* mountpoint) { } void revert_unmount() { - vector targets; + set targets; // Unmount dummy skeletons and MAGISKTMP // since mirror nodes are always mounted under skeleton, we don't have to specifically unmount for (auto &info: parse_mount_info("self")) { if (info.source == "magisk" || info.source == "worker" || // magisktmp tmpfs info.root.starts_with("/adb/modules")) { // bind mount from data partition - targets.push_back(info.target); + targets.insert(info.target); + } + } + + if (targets.empty()) return; + + for (auto last_target = targets.cbegin(), iter = next(targets.cbegin()); iter != targets.cend();) { + if (iter->starts_with(*last_target)) { + iter = targets.erase(iter); + } else { + last_target = iter++; } }