1
mirror of https://github.com/topjohnwu/Magisk synced 2024-10-21 06:31:56 +02:00

Fix daemon crashes in encrypted /data

This commit is contained in:
topjohnwu 2017-06-08 19:15:51 +08:00
parent 0980cb6eb5
commit 201e32d4c4
2 changed files with 12 additions and 11 deletions

View File

@ -21,6 +21,10 @@
static char *buf, *buf2;
static struct vector module_list;
#ifdef DEBUG
static int debug_log_pid, debug_log_fd;
#endif
/******************
* Node structure *
******************/
@ -485,12 +489,20 @@ unblock:
void post_fs_data(int client) {
// Error handler
err_handler = unblock_boot_process;
// ack
write_int(client, 0);
close(client);
if (!check_data())
goto unblock;
#ifdef DEBUG
// Start debug logs in new process
debug_log_fd = xopen(DEBUG_LOG, O_WRONLY | O_CREAT | O_CLOEXEC | O_TRUNC, 0644);
char *const command[] = { "logcat", "-v", "brief", NULL };
debug_log_pid = run_command(0, &debug_log_fd, "/system/bin/logcat", command);
#endif
LOGI("** post-fs-data mode running\n");
// uninstaller

View File

@ -15,10 +15,6 @@
#include "utils.h"
#include "daemon.h"
#ifdef DEBUG
int debug_log_pid, debug_log_fd;
#endif
static void *logger_thread(void *args) {
// Setup error handler
err_handler = exit_thread;
@ -47,11 +43,4 @@ void monitor_logs() {
pthread_t thread;
xpthread_create(&thread, NULL, logger_thread, NULL);
pthread_detach(thread);
#ifdef DEBUG
// Start debug logs in new process
debug_log_fd = xopen(DEBUG_LOG, O_WRONLY | O_CREAT | O_CLOEXEC | O_TRUNC, 0644);
char *const command[] = { "logcat", "-v", "brief", NULL };
debug_log_pid = run_command(0, &debug_log_fd, "/system/bin/logcat", command);
#endif
}