From c88dc8795be21fdad59bff73274f4476b552258d Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Mon, 2 Jul 2018 22:48:26 +0800 Subject: [PATCH] Single log file --- native/jni/core/log_monitor.c | 17 ++--------------- native/jni/include/magisk.h | 1 - 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/native/jni/core/log_monitor.c b/native/jni/core/log_monitor.c index 53167f6cb..657c6cf04 100644 --- a/native/jni/core/log_monitor.c +++ b/native/jni/core/log_monitor.c @@ -22,8 +22,7 @@ static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; enum { HIDE_EVENT, - LOG_EVENT, - DEBUG_EVENT + LOG_EVENT }; struct log_listener { @@ -36,12 +35,7 @@ static int am_proc_start_filter(const char *log) { } static int magisk_log_filter(const char *log) { - char *ss; - return (ss = strstr(log, " Magisk")) && (ss[-1] != 'D') && (ss[-1] != 'V'); -} - -static int magisk_debug_log_filter(const char *log) { - return strstr(log, "am_proc_start") == NULL; + return !am_proc_start_filter(log); } static struct log_listener log_events[] = { @@ -52,10 +46,6 @@ static struct log_listener log_events[] = { { /* LOG_EVENT */ .fd = -1, .filter = magisk_log_filter - }, - { /* DEBUG_EVENT */ - .fd = -1, - .filter = magisk_debug_log_filter } }; #define EVENT_NUM (sizeof(log_events) / sizeof(struct log_listener)) @@ -114,9 +104,6 @@ void log_daemon() { // Setup log dumps rename(LOGFILE, LOGFILE ".bak"); log_events[LOG_EVENT].fd = xopen(LOGFILE, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, 0644); -#ifdef MAGISK_DEBUG - log_events[DEBUG_EVENT].fd = xopen(DEBUG_LOG, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, 0644); -#endif int log_fd = -1, log_pid; char line[PIPE_BUF]; diff --git a/native/jni/include/magisk.h b/native/jni/include/magisk.h index c6bb0b07a..ff6f428f1 100644 --- a/native/jni/include/magisk.h +++ b/native/jni/include/magisk.h @@ -30,7 +30,6 @@ #define DATABIN SECURE_DIR "/magisk" #define MAGISKDB SECURE_DIR "/magisk.db" #define SIMPLEMOUNT SECURE_DIR "/magisk_simple" -#define DEBUG_LOG SECURE_DIR "/magisk_debug.log" #define MANAGERAPK DATABIN "/magisk.apk" #define MAGISKRC "/init.magisk.rc"