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
This commit is contained in:
Konstantin Belousov 2006-10-21 11:49:07 +00:00
parent f2890dbd24
commit 129ccff2fb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=163566

View File

@ -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);
}