Samba 2.2.2 problem in lib/sprintf.c

Jeremy Allison jra at samba.org
Wed Oct 24 16:50:01 GMT 2001


On Tue, Oct 23, 2001 at 02:44:16PM -0700, Orwig, Paul wrote:
> I'm trying to compile Samba 2.2.2 for HPUX an ran into what looks like a
> logic problem in the sprintf.c code.
> The original code uses OR ( || ) and caused the new vsnprintf and snprintf
> routines to be added despite being 
> defined previously.
> 
> Below is the corrected code that has eliminated the errors.
> 
> 
> #if !defined(HAVE_VSNPRINTF) && !defined(HAVE_C99_VSNPRINTF)
>  int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
> {
>         return dopr(str, count, fmt, args);
> }
> #endif
> 
> #if !defined(HAVE_SNPRINTF) && !defined(HAVE_C99_VSNPRINTF)
>  int snprintf(char *str,size_t count,const char *fmt,...)
> {
>         size_t ret;
>         va_list ap;
> 
>         va_start(ap, fmt);
>         ret = vsnprintf(str, count, fmt, ap);
>         va_end(ap);
>         return ret;
> }
> #endif
> 
> 
> Let me know if this breaks something or is just an untested feature!

Looks good - thanks !

Jeremy.




More information about the samba-technical mailing list