mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-26 01:27:23 +00:00
Bring back log dumping
This commit is contained in:
parent
b106d1c501
commit
014105f0a0
@ -636,6 +636,22 @@ void unlock_blocks() {
|
|||||||
close(dev);
|
close(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool log_dump = false;
|
||||||
|
static void dump_logs() {
|
||||||
|
if (log_dump)
|
||||||
|
return;
|
||||||
|
int test = exec_command_sync("/system/bin/logcat", "-d", "-f", "/dev/null");
|
||||||
|
chmod("/dev/null", 0666);
|
||||||
|
if (test != 0)
|
||||||
|
return;
|
||||||
|
rename(LOGFILE, LOGFILE ".bak");
|
||||||
|
int fd = xopen(LOGFILE, O_WRONLY | O_APPEND | O_CREAT | O_CLOEXEC, 0644);
|
||||||
|
exec_t exec { .fd = fd };
|
||||||
|
exec_command(exec, "/system/bin/logcat", "-s", "Magisk");
|
||||||
|
log_dump = true;
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
* Entry points *
|
* Entry points *
|
||||||
****************/
|
****************/
|
||||||
@ -658,6 +674,8 @@ void post_fs_data(int client) {
|
|||||||
if (!check_data())
|
if (!check_data())
|
||||||
unblock_boot_process();
|
unblock_boot_process();
|
||||||
|
|
||||||
|
dump_logs();
|
||||||
|
|
||||||
LOGI("** post-fs-data mode running\n");
|
LOGI("** post-fs-data mode running\n");
|
||||||
|
|
||||||
// Unlock all blocks for rw
|
// Unlock all blocks for rw
|
||||||
@ -781,6 +799,8 @@ void late_start(int client) {
|
|||||||
write_int(client, 0);
|
write_int(client, 0);
|
||||||
close(client);
|
close(client);
|
||||||
|
|
||||||
|
dump_logs();
|
||||||
|
|
||||||
if (access(SECURE_DIR, F_OK) != 0) {
|
if (access(SECURE_DIR, F_OK) != 0) {
|
||||||
// It's safe to create the folder at this point if the system didn't create it
|
// It's safe to create the folder at this point if the system didn't create it
|
||||||
xmkdir(SECURE_DIR, 0700);
|
xmkdir(SECURE_DIR, 0700);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user