No greedy match to find parent mount point

This fixes /sys is considered as a parent mount point of /system
This commit is contained in:
LoveSy
2023-03-03 22:53:53 +08:00
committed by John Wu
parent b9213b7043
commit 1aade8f8a8
2 changed files with 14 additions and 10 deletions
+4 -3
View File
@@ -27,11 +27,12 @@ void revert_unmount() {
if (targets.empty()) return;
for (auto last_target = targets.cbegin(), iter = next(targets.cbegin()); iter != targets.cend();) {
if (iter->starts_with(*last_target)) {
auto last_target = *targets.cbegin() + '/';
for (auto iter = next(targets.cbegin()); iter != targets.cend();) {
if (iter->starts_with(last_target)) {
iter = targets.erase(iter);
} else {
last_target = iter++;
last_target = *iter++ + '/';
}
}