X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fff-printf.c;h=8825a2880437dff93a19e29b5e947d68b294a64b;hb=434c630cf7aa4b4facc1d2fcfb6e9bc4cf21dff1;hp=fe9c964283d2a0e6e1eff67b90fd3420e89014b7;hpb=e23d835f0f224d48f5c0b39a0f2bd18b342e703d;p=libucw.git diff --git a/lib/ff-printf.c b/lib/ff-printf.c index fe9c9642..8825a288 100644 --- a/lib/ff-printf.c +++ b/lib/ff-printf.c @@ -1,7 +1,7 @@ /* * UCW Library -- Printf on Fastbuf Streams * - * (c) 2002 Martin Mares + * (c) 2002--2005 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -10,6 +10,7 @@ #include "lib/lib.h" #include "lib/fastbuf.h" +#include #include int @@ -17,11 +18,14 @@ vbprintf(struct fastbuf *b, char *msg, va_list args) { byte *buf; int len, r; + va_list args2; len = bdirect_write_prepare(b, &buf); if (len >= 16) { - r = vsnprintf(buf, len, msg, args); + va_copy(args2, args); + r = vsnprintf(buf, len, msg, args2); + va_end(args2); if (r < 0) len = 256; else if (r < len) @@ -38,7 +42,9 @@ vbprintf(struct fastbuf *b, char *msg, va_list args) while (1) { buf = alloca(len); - r = vsnprintf(buf, len, msg, args); + va_copy(args2, args); + r = vsnprintf(buf, len, msg, args2); + va_end(args2); if (r < 0) len += len; else if (r < len)