mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-16 09:52:31 +00:00
Several improvements
This commit is contained in:
@@ -46,16 +46,17 @@ void launch_magiskhide(int client) {
|
||||
err_handler = do_nothing;
|
||||
|
||||
if (hideEnabled) {
|
||||
write_int(client, HIDE_IS_ENABLED);
|
||||
close(client);
|
||||
if (client > 0) {
|
||||
write_int(client, HIDE_IS_ENABLED);
|
||||
close(client);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
hideEnabled = 1;
|
||||
LOGI("* Starting MagiskHide\n");
|
||||
|
||||
hideEnabled = 1;
|
||||
|
||||
if (client != -1) {
|
||||
if (client > 0) {
|
||||
if (setprop(MAGISKHIDE_PROP, "1"))
|
||||
goto error;
|
||||
}
|
||||
|
@@ -17,9 +17,9 @@
|
||||
#include "utils.h"
|
||||
#include "magiskhide.h"
|
||||
|
||||
static int zygote_num = 0;
|
||||
static int zygote_num;
|
||||
static char init_ns[32], zygote_ns[2][32];
|
||||
static int log_pid = 0, log_fd = 0;
|
||||
static int log_pid, log_fd;
|
||||
static char *buffer;
|
||||
|
||||
static void read_namespace(const int pid, char* target, const size_t size) {
|
||||
@@ -85,6 +85,7 @@ void proc_monitor() {
|
||||
LOGI("proc_monitor: init ns=%s\n", init_ns);
|
||||
|
||||
// Get the mount namespace of zygote
|
||||
zygote_num = 0;
|
||||
while(!zygote_num) {
|
||||
// Check zygote every 2 secs
|
||||
sleep(2);
|
||||
@@ -107,8 +108,12 @@ void proc_monitor() {
|
||||
|
||||
// Monitor am_proc_start
|
||||
char *const command[] = { "logcat", "-b", "events", "-v", "raw", "-s", "am_proc_start", NULL };
|
||||
log_fd = 0;
|
||||
log_pid = run_command(0, &log_fd, "/system/bin/logcat", command);
|
||||
|
||||
if (log_pid < 0) continue;
|
||||
if (kill(log_pid, 0)) continue;
|
||||
|
||||
while(fdgets(buffer, PATH_MAX, log_fd)) {
|
||||
int ret, comma = 0;
|
||||
char *pos = buffer, *line, processName[256];
|
||||
|
Reference in New Issue
Block a user