From ab207a1bb3ff610ca967a851696e6da341354279 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 3 Dec 2020 20:53:19 -0800 Subject: [PATCH] va_list cannot be reused on x86 --- native/jni/core/daemon.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/native/jni/core/daemon.cpp b/native/jni/core/daemon.cpp index 66e838eb0..5a909a1e0 100644 --- a/native/jni/core/daemon.cpp +++ b/native/jni/core/daemon.cpp @@ -158,6 +158,9 @@ void setup_logfile(bool reset) { } static int magisk_log(int prio, const char *fmt, va_list ap) { + va_list args; + va_copy(args, ap); + // Log to logcat __android_log_vprint(prio, "Magisk", fmt, ap); @@ -185,7 +188,7 @@ static int magisk_log(int prio, const char *fmt, va_list ap) { int ms = tv.tv_usec / 1000; len += sprintf(buf + len, ".%03d %c : ", ms, type); strcpy(buf + len, fmt); - return vfprintf(log_file, buf, ap); + return vfprintf(log_file, buf, args); } static void android_logging() {