From 3c7ee268c42dd546dfb867ecee76167df5adef46 Mon Sep 17 00:00:00 2001 From: kib Date: Sat, 21 Oct 2006 11:49:07 +0000 Subject: Workaround for (what seems to be) compiler error for gcc 3.4.6. On i386 with default optimization level (-O2), va_list pointer ap in the __v2printf function is advanced before the use. That cause argument shift and garbage instead last argument in printf-family when xprintf is activated. The nsswitch is easy victim of the bug. Reviewed by: kan Approved by: kan (mentor) MFC after: 1 week --- lib/libc/stdio/xprintf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/libc/stdio') diff --git a/lib/libc/stdio/xprintf.c b/lib/libc/stdio/xprintf.c index 8d529fc..5930135 100644 --- a/lib/libc/stdio/xprintf.c +++ b/lib/libc/stdio/xprintf.c @@ -261,7 +261,7 @@ static struct { static int -__v2printf(FILE *fp, const char *fmt0, unsigned pct, const va_list ap) +__v2printf(FILE *fp, const char *fmt0, unsigned pct, const va_list ap1) { struct printf_info *pi, *pil; const char *fmt; @@ -274,7 +274,9 @@ __v2printf(FILE *fp, const char *fmt0, unsigned pct, const va_list ap) int ret = 0; int n; struct __printf_io io; + va_list ap; + va_copy(ap, ap1); __printf_init(&io); io.fp = fp; @@ -561,6 +563,7 @@ __v2printf(FILE *fp, const char *fmt0, unsigned pct, const va_list ap) errx(1, "render[%c] = NULL", *fmt); } __printf_flush(&io); + va_end(ap); return (ret); } -- cgit v1.1