From: Michihiro NAKAJIMA Date: Wed, 16 Dec 2009 19:34:53 +0000 (-0500) Subject: Avoid segv on linux64. It caused at second calling vfprintf() of vlogprintf() X-Git-Tag: v2.8.0~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f017d8befede835f2390288805ed63acd3a1a15a;p=thirdparty%2Flibarchive.git Avoid segv on linux64. It caused at second calling vfprintf() of vlogprintf() in */test/main.c. Use a copy of ap for second calling vfprintf(). SVN-Revision: 1755 --- diff --git a/cpio/test/main.c b/cpio/test/main.c index ac651f870..15dfd7503 100644 --- a/cpio/test/main.c +++ b/cpio/test/main.c @@ -199,10 +199,19 @@ static FILE *logfile; static void vlogprintf(const char *fmt, va_list ap) { +#ifdef va_copy + va_list lfap; + va_copy(lfap, ap); +#endif if (log_console) vfprintf(stdout, fmt, ap); if (logfile != NULL) +#ifdef va_copy + vfprintf(logfile, fmt, lfap); + va_end(lfap); +#else vfprintf(logfile, fmt, ap); +#endif } static void diff --git a/libarchive/test/main.c b/libarchive/test/main.c index c3dfb5856..5a921b97d 100644 --- a/libarchive/test/main.c +++ b/libarchive/test/main.c @@ -198,10 +198,19 @@ static FILE *logfile; static void vlogprintf(const char *fmt, va_list ap) { +#ifdef va_copy + va_list lfap; + va_copy(lfap, ap); +#endif if (log_console) vfprintf(stdout, fmt, ap); if (logfile != NULL) +#ifdef va_copy + vfprintf(logfile, fmt, lfap); + va_end(lfap); +#else vfprintf(logfile, fmt, ap); +#endif } static void diff --git a/tar/test/main.c b/tar/test/main.c index d26f98124..a9f674587 100644 --- a/tar/test/main.c +++ b/tar/test/main.c @@ -200,10 +200,19 @@ static FILE *logfile; static void vlogprintf(const char *fmt, va_list ap) { +#ifdef va_copy + va_list lfap; + va_copy(lfap, ap); +#endif if (log_console) vfprintf(stdout, fmt, ap); if (logfile != NULL) +#ifdef va_copy + vfprintf(logfile, fmt, lfap); + va_end(lfap); +#else vfprintf(logfile, fmt, ap); +#endif } static void