summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/xprintf.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2006-10-21 11:49:07 +0000
committerkib <kib@FreeBSD.org>2006-10-21 11:49:07 +0000
commit3c7ee268c42dd546dfb867ecee76167df5adef46 (patch)
tree105c4e89bf8910b51cf6e239fc58445f8bc149ed /lib/libc/stdio/xprintf.c
parent09db1858a756478aef3a5b46ab5909c7f5d51fb2 (diff)
downloadFreeBSD-src-3c7ee268c42dd546dfb867ecee76167df5adef46.zip
FreeBSD-src-3c7ee268c42dd546dfb867ecee76167df5adef46.tar.gz
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
Diffstat (limited to 'lib/libc/stdio/xprintf.c')
-rw-r--r--lib/libc/stdio/xprintf.c5
1 files changed, 4 insertions, 1 deletions
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);
}
OpenPOWER on IntegriCloud