From 70330d222e3231af111e9d7b500ed86e0980a2c6 Mon Sep 17 00:00:00 2001
From: wangjufeng <wangjufeng@huawei.com>
Date: Fri, 20 Mar 2020 19:28:02 +0800
Subject: [PATCH] lvm2: fix the reuse of va_list

After a va_list is used, it should not be used again. Because it
is already changed after using.

Signed-off-by: wangjufeng<wangjufeng@huawei.com>
---
 libdm/libdm-common.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index 2fd8783..7f2fb81 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -113,6 +113,7 @@ static void _default_log_line(int level, const char *file,
 			      int line, int dm_errno_or_class,
 			      const char *f, va_list ap)
 {
+	va_list copyap;
 	static int _abort_on_internal_errors = -1;
 	static int _debug_with_line_numbers = -1;
 	FILE *out = log_stderr(level) ? stderr : stdout;
@@ -131,8 +132,10 @@ static void _default_log_line(int level, const char *file,
 		if (_debug_with_line_numbers)
 			fprintf(out, "%s:%d     ", file, line);
 
+		va_copy(copyap, ap);
 		vfprintf(out, f, ap);
-		vsyslog(level, f, ap);
+		vsyslog(level, f, copyap);
+		va_end(copyap);
 		fputc('\n', out);
 	}
 
-- 
1.8.3.1

