From 3556a3d70867a30be61ecb64e32a5ddfecc9d89b Mon Sep 17 00:00:00 2001 From: Ales Kozumplik Date: Thu, 25 Feb 2010 10:56:40 +0100 Subject: It's necessary to give each vfprintf invocation a fresh va_list (#568235) Commit 3fb12e4eafebfa3885c25b9ab93e9c35f6847425 changed the way variable argument list is handled in log.c this causes SIGSEGV on x86_64. I should see 'man vfprintf' the next time. --- loader/log.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/loader/log.c b/loader/log.c index 5ed3c6a94..7824d9273 100644 --- a/loader/log.c +++ b/loader/log.c @@ -97,14 +97,17 @@ static void printLogHeader(int level, FILE *outfile) { void logMessageV(int level, const char * s, va_list ap) { va_list apc; - va_copy(apc, ap); /* Log everything into syslog */ + va_copy(apc, ap); vsyslog(mapLogLevel(level), s, apc); + va_end(apc); /* Only log to the screen things that are above the minimum level. */ if (tty_logfile && level >= minLevel) { printLogHeader(level, tty_logfile); + va_copy(apc, ap); vfprintf(tty_logfile, s, apc); + va_end(apc); fprintf(tty_logfile, "\n"); fflush(tty_logfile); } @@ -112,12 +115,12 @@ void logMessageV(int level, const char * s, va_list ap) { /* But log everything to the file. */ if (file_logfile) { printLogHeader(level, file_logfile); + va_copy(apc, ap); vfprintf(file_logfile, s, apc); + va_end(apc); fprintf(file_logfile, "\n"); fflush(file_logfile); } - - va_end(apc); } void logMessage(int level, const char * s, ...) { -- cgit