On OSF/1 5.1, the printf() and fprintf() replacements no longer produced
output of more than 1999 bytes. Wheeee...


2007-11-03  Bruno Haible  <[EMAIL PROTECTED]>

        * lib/vasnprintf.c (VASNPRINTF): Don't assume that snprintf's return
        value is C99 compliant.
        Needed for OSF/1 5.1.

*** lib/vasnprintf.c.orig       2007-11-03 15:20:09.000000000 +0100
--- lib/vasnprintf.c    2007-11-03 15:20:02.000000000 +0100
***************
*** 3658,3665 ****
                      }
  
  #if USE_SNPRINTF
!                   /* Handle overflow of the allocated buffer.  */
!                   if (count >= maxlen)
                      {
                        /* If maxlen already has attained its allowed maximum,
                           allocating more memory will not increase maxlen.
--- 3658,3669 ----
                      }
  
  #if USE_SNPRINTF
!                   /* Handle overflow of the allocated buffer.
!                      If such an overflow occurs, a C99 compliant snprintf()
!                      returns a count >= maxlen.  However, a non-compliant
!                      snprintf() function returns only count = maxlen - 1.  To
!                      cover both cases, test whether count >= maxlen - 1.  */
!                   if ((unsigned int) count + 1 >= maxlen)
                      {
                        /* If maxlen already has attained its allowed maximum,
                           allocating more memory will not increase maxlen.



Reply via email to