From 231cd4fd9e135bbc5f8526771b6be05f0e2d682c Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 11 Jul 2011 22:07:17 +1000 Subject: [PATCH] va list needs to be copied as it's invalidated either way. --- util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/util.c b/util.c index ef680399..d3cc6fa5 100644 --- a/util.c +++ b/util.c @@ -90,12 +90,15 @@ void vapplog(int prio, const char *fmt, va_list ap) tm.tm_min, tm.tm_sec, fmt); - log_curses(f, ap); /* Only output to stderr if it's not going to the screen as well */ if (opt_log_output && !isatty(fileno((FILE *)stderr))) { - vfprintf(stderr, f, ap); /* atomic write to stderr */ + va_list apc; + + va_copy(apc, ap); + vfprintf(stderr, f, apc); /* atomic write to stderr */ fflush(stderr); } + log_curses(f, ap); } }