mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 22:07:38 +00:00
Make a copy of logcat and use that instead
When Magisk is magic mounting /system/bin, there is a chance that logcat would be temporarily unavailable. Leave a copy and use that for magisklogd
This commit is contained in:
parent
fc791b4371
commit
c2b016370b
@ -772,6 +772,9 @@ void startup() {
|
|||||||
xsymlink(MIRRDIR "/bin/busybox", BBPATH "/busybox");
|
xsymlink(MIRRDIR "/bin/busybox", BBPATH "/busybox");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Preserve a copy of logcat
|
||||||
|
cp_afc("/system/bin/logcat", MIRRDIR "/bin/logcat");
|
||||||
|
|
||||||
// Start post-fs-data mode
|
// Start post-fs-data mode
|
||||||
execl("/sbin/magisk.bin", "magisk", "--post-fs-data", NULL);
|
execl("/sbin/magisk.bin", "magisk", "--post-fs-data", NULL);
|
||||||
}
|
}
|
||||||
|
@ -132,11 +132,11 @@ static void log_daemon() {
|
|||||||
|
|
||||||
// Construct cmdline
|
// Construct cmdline
|
||||||
vec_init(&log_cmd);
|
vec_init(&log_cmd);
|
||||||
vec_push_back(&log_cmd, "/system/bin/logcat");
|
vec_push_back(&log_cmd, MIRRDIR "/bin/logcat");
|
||||||
// Test whether these buffers actually works
|
// Test whether these buffers actually works
|
||||||
const char* b[] = { "main", "events", "crash" };
|
const char* b[] = { "main", "events", "crash" };
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
if (exec_command_sync("/system/bin/logcat", "-b", b[i], "-d", "-f", "/dev/null", NULL) == 0)
|
if (exec_command_sync(MIRRDIR "/bin/logcat", "-b", b[i], "-d", "-f", "/dev/null", NULL) == 0)
|
||||||
vec_push_back_all(&log_cmd, "-b", b[i], NULL);
|
vec_push_back_all(&log_cmd, "-b", b[i], NULL);
|
||||||
}
|
}
|
||||||
chmod("/dev/null", 0666);
|
chmod("/dev/null", 0666);
|
||||||
@ -174,7 +174,7 @@ static void log_daemon() {
|
|||||||
|
|
||||||
int start_log_daemon() {
|
int start_log_daemon() {
|
||||||
if (!log_daemon_started) {
|
if (!log_daemon_started) {
|
||||||
if (exec_command_sync("/system/bin/logcat", "-d", "-f", "/dev/null", NULL) == 0) {
|
if (exec_command_sync(MIRRDIR "/bin/logcat", "-d", "-f", "/dev/null", NULL) == 0) {
|
||||||
if (fork_dont_care() == 0)
|
if (fork_dont_care() == 0)
|
||||||
log_daemon();
|
log_daemon();
|
||||||
// Wait till we can connect to log_daemon
|
// Wait till we can connect to log_daemon
|
||||||
|
Loading…
x
Reference in New Issue
Block a user