aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdio/xprintf.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2006-10-21 11:49:07 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2006-10-21 11:49:07 +0000
commit129ccff2fb9df946928ba4f62605570e86732c4e (patch)
tree105c4e89bf8910b51cf6e239fc58445f8bc149ed /lib/libc/stdio/xprintf.c
parentf2890dbd24cf1a6d249a99fd9d1003e6e61f60a1 (diff)
downloadsrc-129ccff2fb9df946928ba4f62605570e86732c4e.tar.gz
src-129ccff2fb9df946928ba4f62605570e86732c4e.zip
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
Notes
Notes: svn path=/head/; revision=163566
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 8d529fcd2c20..5930135b34aa 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);
}