Fix stupid remount bug

This commit is contained in:
Nullptr
2023-02-24 16:43:53 +08:00
parent 03575edd96
commit f395cfb490

View File

@@ -10,7 +10,7 @@ static void lazy_unmount(const char* mountpoint) {
if (umount2(mountpoint, MNT_DETACH) != -1) { if (umount2(mountpoint, MNT_DETACH) != -1) {
LOGD("Unmounted (%s)", mountpoint); LOGD("Unmounted (%s)", mountpoint);
} else { } else {
PLOGE("Failed to unmount: %s (%s)", strerror(errno), mountpoint); LOGW("Failed to unmount: %s (%s)", strerror(errno), mountpoint);
} }
} }
@@ -45,11 +45,9 @@ void revert_unmount() {
parse_mnt("/proc/self/mounts", [&](mntent* mentry) { parse_mnt("/proc/self/mounts", [&](mntent* mentry) {
if (mentry->mnt_type == "overlay"sv) { if (mentry->mnt_type == "overlay"sv) {
for (auto it = backups.begin(); it != backups.end(); it++) { backups.remove_if([&](auto& mnt) {
backups.remove_if([&](auto& mnt) { return mnt.first == mentry->mnt_dir && mnt.second == mentry->mnt_opts;
return mnt.first == mentry->mnt_dir && mnt.second == mentry->mnt_opts; });
});
}
} }
return true; return true;
}); });