From 49cd57fbd9cb1410da80883ec21af2a3e172fae6 Mon Sep 17 00:00:00 2001 From: curaga Date: Thu, 30 May 2013 12:52:14 +0000 Subject: [PATCH] Inline functions may complicate passing va_lists around, as they can be stack offsets. See http://julipedia.meroh.net/2011/09/using-vacopy-to-safely-pass-ap.html git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12811 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/utils/log.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/log.cpp b/src/utils/log.cpp index d9a8cbb3b..457fcf7b4 100644 --- a/src/utils/log.cpp +++ b/src/utils/log.cpp @@ -168,10 +168,15 @@ void Log::printMessage(int level, const char *component, const char *format, if(!m_file_stdout || UserConfigParams::m_log_errors_to_console) // log to console & file { + VALIST out; + va_copy(out, va_list); + setTerminalColor((LogLevel)level); printf("[%s] %s: ", names[level], component); - vprintf(format, va_list); + vprintf(format, out); resetTerminalColor(); // this prints a \n + + va_end(out); } if(m_file_stdout) {