mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 18:15:30 +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 <magisk.hpp>
|
||||
@ -13,14 +14,24 @@ static void lazy_unmount(const char* mountpoint) {
|
||||
}
|
||||
|
||||
void revert_unmount() {
|
||||
vector<string> targets;
|
||||
set<string> 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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user