mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-21 21:51:28 +00:00
Filter duplicate mount points
This prevents umounting existing overlay mount points
This commit is contained in:
parent
2285f5e888
commit
f59fbd5dca
@ -1,3 +1,4 @@
|
|||||||
|
#include <set>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
|
|
||||||
#include <magisk.hpp>
|
#include <magisk.hpp>
|
||||||
@ -13,14 +14,24 @@ static void lazy_unmount(const char* mountpoint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void revert_unmount() {
|
void revert_unmount() {
|
||||||
vector<string> targets;
|
set<string> targets;
|
||||||
|
|
||||||
// Unmount dummy skeletons and MAGISKTMP
|
// Unmount dummy skeletons and MAGISKTMP
|
||||||
// since mirror nodes are always mounted under skeleton, we don't have to specifically unmount
|
// since mirror nodes are always mounted under skeleton, we don't have to specifically unmount
|
||||||
for (auto &info: parse_mount_info("self")) {
|
for (auto &info: parse_mount_info("self")) {
|
||||||
if (info.source == "magisk" || info.source == "worker" || // magisktmp tmpfs
|
if (info.source == "magisk" || info.source == "worker" || // magisktmp tmpfs
|
||||||
info.root.starts_with("/adb/modules")) { // bind mount from data partition
|
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++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user