From a1a296f5eb1b1fa83bc8762285821be14d500e98 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Thu, 6 Jun 2013 14:36:13 +0930 Subject: [PATCH] Issue #62, use va_copy() in loops --- log.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/log.c b/log.c index 6ec721b7..9bbc5bfd 100644 --- a/log.c +++ b/log.c @@ -394,7 +394,10 @@ static void _log_iterator_vprintf_nl(_log_iterator *it, int level, struct __sour _log_iterator_rewind(it); while (_log_iterator_next(it, level)) { _log_prefix_whence(it, whence); - vxprintf(it->xpf, fmt, ap); + va_list ap1; + va_copy(ap1, ap); + vxprintf(it->xpf, fmt, ap1); + va_end(ap1); } } @@ -697,7 +700,10 @@ void vlogMessage(int level, struct __sourceloc whence, const char *fmt, va_list _rotate_log_file(&it); while (_log_iterator_next(&it, level)) { _log_prefix_whence(&it, whence); - vxprintf(it.xpf, fmt, ap); + va_list ap1; + va_copy(ap1, ap); + vxprintf(it.xpf, fmt, ap1); + va_end(ap1); } } }