Fix logs on decrypted /data

This commit is contained in:
topjohnwu 2017-12-07 23:25:43 +08:00
parent 942c870981
commit e404476609
3 changed files with 5 additions and 8 deletions

View File

@ -20,7 +20,6 @@
#include "daemon.h"
#include "resetprop.h"
pthread_t sepol_patch;
int is_daemon_init = 0, seperate_vendor = 0;
static void *request_handler(void *args) {
@ -232,6 +231,9 @@ void start_daemon() {
exit(1);
xlisten(fd, 10);
// Start the log monitor
monitor_logs();
if ((is_daemon_init = access(MAGISKTMP, F_OK) == 0)) {
// Restart stuffs if the daemon is restarted
exec_command_sync("logcat", "-b", "all", "-c", NULL);
@ -241,9 +243,6 @@ void start_daemon() {
daemon_init();
}
// Start the log monitor
monitor_logs();
LOGI("Magisk v" xstr(MAGISK_VERSION) "(" xstr(MAGISK_VER_CODE) ") daemon started\n");
// Change process name

View File

@ -50,7 +50,7 @@ static void *logger_thread(void *args) {
static void *magisk_log_thread(void *args) {
int have_data = 0;
// Temp buffer for logs before we have data access
// Buffer logs before we have data access
struct vector logs;
vec_init(&logs);
@ -70,8 +70,7 @@ static void *magisk_log_thread(void *args) {
if (!have_data) {
if ((have_data = check_data())) {
// Dump buffered logs to file
if (!is_daemon_init)
rename(LOGFILE, LASTLOG);
rename(LOGFILE, LASTLOG);
log = xfopen(LOGFILE, "a");
setbuf(log, NULL);
char *tmp;

View File

@ -7,7 +7,6 @@
#include <pthread.h>
#include <sys/un.h>
extern pthread_t sepol_patch;
extern int is_daemon_init, seperate_vendor;
// Commands require connecting to daemon