Re: [xml] vsnprintf

On Wed, Dec 15, 2010 at 12:46:00PM -0600, Peter O'Gorman wrote:

We saw some test failures running the python tests for libxml-2.7.8 that
turned out to be related to libc's vsnprintf being buggy.

Unfortunately, though vsnprintf(buf,len,format,ap) should return the number
of chars that would have been written to buf (not including the final
NULL), not all systems see it that way.

It is not that simple, snprintf(3) on Linux says:

       Concerning  the  return  value  of snprintf(), SUSv2 and C99 contradict
       each other: when snprintf() is called with size=0 then SUSv2 stipulates
       an  unspecified  return  value  less than 1, while C99 allows str to be
       NULL in this case, and gives the return value (as always) as the number
       of  characters  that  would have been written in case the output string
       has been large enough.



       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]