Commit 9e22b807 authored by topjohnwu's avatar topjohnwu

Update unmounting policies

parent 7eed9c4a
......@@ -89,10 +89,11 @@ int hide_daemon() {
}
}
// First unmount the mirror, dummy skeletons, cache mounts, and /sbin links
// First unmount dummy skeletons, /sbin links, cache mounts, and mirrors
vec_for_each_r(&mount_list, line) {
if (strstr(line, "tmpfs /system") || strstr(line, "tmpfs /vendor") || strstr(line, "tmpfs /sbin")
|| (strstr(line, cache_block) && strstr(line, "/system/")) || strstr(line, MIRRDIR) ) {
|| (strstr(line, cache_block) && (strstr(line, " /system") || strstr(line, " /vendor")))
|| strstr(line, MIRRDIR)) {
sscanf(line, "%*s %512s", buffer);
lazy_unmount(buffer);
}
......@@ -105,9 +106,25 @@ int hide_daemon() {
vec_init(&mount_list);
file_to_vector(buffer, &mount_list);
// Unmount loop mounts
// Unmount loop mounts on /system, /vendor, /magisk
vec_for_each_r(&mount_list, line) {
if (strstr(line, "/dev/block/loop") || strstr(line, DUMMDIR)) {
if (strstr(line, "/dev/block/loop")
&& (strstr(line, " /system") || strstr(line, " /vendor") || strstr(line, " /magisk"))) {
sscanf(line, "%*s %512s", buffer);
lazy_unmount(buffer);
}
free(line);
}
vec_destroy(&mount_list);
// Re-read mount infos
snprintf(buffer, sizeof(buffer), "/proc/%d/mounts", pid);
vec_init(&mount_list);
file_to_vector(buffer, &mount_list);
// Unmount remaining mounts on dummy skeletons
vec_for_each_r(&mount_list, line) {
if (strstr(line, DUMMDIR)) {
sscanf(line, "%*s %512s", buffer);
lazy_unmount(buffer);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment