[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
non-EBCDIC ber_pvt_vsnprintf is not portable (ITS#2128)
Full_Name: Dan Riley
Version: 2.1.5
OS: Tru64 4.0F
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (128.84.46.236)
ber_pvt_vsnprintf always returns an empty string on Tru64 4.0F. This is
entirely consistent with ANSI/ISO 9899-1990 (ANSI C 89) and SUSv2, which say (of
the buffer passed to setvbuf) that "the contents of the array at any time are
indeterminate", which means passing a buffer to setvbuf cannot be used for
formatting. The enclosed patch makes ber_pvt_vsnprintf portable (as long as
vsprintf is available), at the cost of repeating the formatting:
--- libraries/liblber/stdio.c~ Tue Sep 17 10:35:52 2002
+++ libraries/liblber/stdio.c Sun Oct 6 15:16:17 2002
@@ -55,6 +55,9 @@
fclose( f );
signal( SIGPIPE, sig );
+ if ( res > 0 && res < n ) {
+ res = vsprintf( str, fmt, ap );
+ }
return res;
}
#endif