From 1e607a70bcfe94959ecc62bc0e41f7b21201dd08 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sat, 9 Oct 2021 14:32:59 +0800 Subject: [PATCH] libc/vsprintf_internal: Call va_copy just like vsyslog Signed-off-by: Xiang Xiao --- libs/libc/stdio/lib_libvsprintf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/libc/stdio/lib_libvsprintf.c b/libs/libc/stdio/lib_libvsprintf.c index 5dc712182c..6e0fef0fd3 100644 --- a/libs/libc/stdio/lib_libvsprintf.c +++ b/libs/libc/stdio/lib_libvsprintf.c @@ -464,7 +464,15 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream, if (fmt_char(fmt) == 'V') { FAR struct va_format *vaf = va_arg(ap, void *); +#ifdef va_copy + va_list copy; + + va_copy(copy, *vaf->va); + vsprintf_internal(stream, NULL, 0, vaf->fmt, copy); + va_end(copy); +#else vsprintf_internal(stream, NULL, 0, vaf->fmt, *vaf->va); +#endif continue; } else