--- ./programs/Xserver/os/save_xprintf.c 2005-11-23 07:32:18.000000000 +0000 +++ ./programs/Xserver/os/xprintf.c 2005-11-23 07:31:55.000000000 +0000 @@ -48,12 +48,22 @@ { char *ret; int size; - va_list va2; - - va_copy(va2, va); - size = vsnprintf(NULL, 0, format, va2); - va_end(va2); - + char *t=NULL; + int buffSize=1; /* larger default value is harder to test, + but faster */ + for (;;) + { + t=(char *)Xalloc(buffSize); + if (t==NULL) + return NULL; + size = vsnprintf(t, buffSize, format, va); + xfree(t); + /* be afraid, we can not trust the return value from vsnprintf + unless it is shorter than the allocated buffer */ + if ((size>0)&&(size