diff options
author | Ales Kozumplik <akozumpl@redhat.com> | 2010-02-25 10:56:40 +0100 |
---|---|---|
committer | Ales Kozumplik <akozumpl@redhat.com> | 2010-02-25 17:41:31 +0100 |
commit | 3556a3d70867a30be61ecb64e32a5ddfecc9d89b (patch) | |
tree | 4af86a3fc49830a906bbda0be4e69481968905e7 | |
parent | 0982f94dc987adc3b6aa4634a3150a7ba01d8229 (diff) | |
download | anaconda-3556a3d70867a30be61ecb64e32a5ddfecc9d89b.tar.gz anaconda-3556a3d70867a30be61ecb64e32a5ddfecc9d89b.tar.xz anaconda-3556a3d70867a30be61ecb64e32a5ddfecc9d89b.zip |
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.
-rw-r--r-- | loader/log.c | 9 |
1 files 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, ...) { |