va_list cannot be reused on x86

This commit is contained in:
topjohnwu 2020-12-03 20:53:19 -08:00
parent f152e8c33d
commit ab207a1bb3

View File

@ -158,6 +158,9 @@ void setup_logfile(bool reset) {
} }
static int magisk_log(int prio, const char *fmt, va_list ap) { static int magisk_log(int prio, const char *fmt, va_list ap) {
va_list args;
va_copy(args, ap);
// Log to logcat // Log to logcat
__android_log_vprint(prio, "Magisk", fmt, ap); __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; int ms = tv.tv_usec / 1000;
len += sprintf(buf + len, ".%03d %c : ", ms, type); len += sprintf(buf + len, ".%03d %c : ", ms, type);
strcpy(buf + len, fmt); strcpy(buf + len, fmt);
return vfprintf(log_file, buf, ap); return vfprintf(log_file, buf, args);
} }
static void android_logging() { static void android_logging() {