Prevent unmounting non-custom mount points

This commit is contained in:
topjohnwu
2018-11-13 01:53:48 -05:00
parent 89be07e1f2
commit 9592a69986
3 changed files with 104 additions and 105 deletions

View File

@@ -23,6 +23,7 @@
#include "flags.h"
static int sockfd = -1;
extern char *system_block, *vendor_block, *magiskloop;
// Workaround for the lack of pthread_cancel
static void term_thread(int) {
@@ -89,7 +90,8 @@ static void hide_daemon(int pid) {
// Unmount everything under /system, /vendor, and loop mounts
for (auto &s : mounts) {
if (s.contains("/dev/block/loop") || s.contains(" /system/") || s.contains(" /vendor/")) {
if ((s.contains(" /system/") || s.contains(" /vendor/")) &&
(s.contains(system_block) || s.contains(vendor_block) || s.contains(magiskloop))) {
sscanf(s, "%*s %4096s", buffer);
lazy_unmount(buffer);
}