mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-11 12:36:12 -08:00
Fix zygiskd not restart when zygote restarts
This commit is contained in:
@@ -15,8 +15,6 @@ using namespace std;
|
||||
|
||||
#define VLOGD(tag, from, to) LOGD("%-8s: %s <- %s\n", tag, to, from)
|
||||
|
||||
static string native_bridge = "0";
|
||||
|
||||
static int bind_mount(const char *reason, const char *from, const char *to) {
|
||||
int ret = xmount(from, to, nullptr, MS_BIND | MS_REC, nullptr);
|
||||
if (ret == 0)
|
||||
@@ -517,23 +515,3 @@ void exec_module_scripts(const char *stage) {
|
||||
[](const module_info &info) -> string_view { return info.name; });
|
||||
exec_module_scripts(stage, module_names);
|
||||
}
|
||||
|
||||
void reset_zygisk(bool restore) {
|
||||
if (!zygisk_enabled) return;
|
||||
static atomic_uint zygote_start_count{1};
|
||||
if (restore) {
|
||||
zygote_start_count = 1;
|
||||
} else if (zygote_start_count.fetch_add(1) > 3) {
|
||||
LOGW("zygote crashes too many times, rolling-back\n");
|
||||
restore = true;
|
||||
}
|
||||
if (restore) {
|
||||
string native_bridge_orig = "0";
|
||||
if (native_bridge.length() > strlen(ZYGISKLDR)) {
|
||||
native_bridge_orig = native_bridge.substr(strlen(ZYGISKLDR));
|
||||
}
|
||||
set_prop(NBPROP, native_bridge_orig.data(), true);
|
||||
} else {
|
||||
set_prop(NBPROP, native_bridge.data(), true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user