summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/error.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5163479..5b6d53e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2011-03-15  Jonathan Nieder <jrnieder@gmail.com>
 
 	* Free IFS state after here document expansion.
+	* Use va_copy when reusing a va_list.
 
 2011-03-15  Harald van Dijk <harald@gigawatt.nl>
 
diff --git a/src/error.c b/src/error.c
index 7ad73bc..9d31989 100644
--- a/src/error.c
+++ b/src/error.c
@@ -143,8 +143,11 @@ exverror(int cond, const char *msg, va_list ap)
 {
 #ifdef DEBUG
 	if (msg) {
+		va_list aq;
 		TRACE(("exverror(%d, \"", cond));
-		TRACEV((msg, ap));
+		va_copy(aq, ap);
+		TRACEV((msg, aq));
+		va_end(aq);
 		TRACE(("\") pid=%d\n", getpid()));
 	} else
 		TRACE(("exverror(%d, NULL) pid=%d\n", cond, getpid()));