On Thu, Dec 16, 2010 at 15:42, Adrian Bunk <[email protected]> wrote: > On Wed, Dec 15, 2010 at 12:46:00PM -0600, Peter O'Gorman wrote: >> Hi, >> >> 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. >
Both SUSv3 and SUSv4 say: If the value of n is zero on a call to snprintf(), nothing shall be written, the number of bytes that would have been written had n been sufficiently large excluding the terminating null shall be returned, and s may be a null pointer. SUSv3: http://pubs.opengroup.org/onlinepubs/009695399/functions/snprintf.html SUSv4: http://pubs.opengroup.org/onlinepubs/9699919799/functions/snprintf.html Thus, at least, we know to where the world is moving :-) -- Andrew W. Nosenko <[email protected]> _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
