X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Fliblber%2Fdebug.c;h=cfec0942e4a3f8f1df78f95fb7d286e8c5ecf60d;hb=1702d408bfc09716ed0fbd42ef8c6bd11c51fd3a;hp=92b52d67b75c3c950079ff850cc476f2a0f80641;hpb=e6460769ab54861e9030d23ba78cc68478e5714c;p=openldap diff --git a/libraries/liblber/debug.c b/libraries/liblber/debug.c index 92b52d67b7..cfec0942e4 100644 --- a/libraries/liblber/debug.c +++ b/libraries/liblber/debug.c @@ -30,7 +30,6 @@ struct DEBUGLEVEL }; int ldap_loglevels[LDAP_SUBSYS_NUM]; -static long numLevels = 0; static FILE *log_file = NULL; static int global_level = 0; @@ -164,7 +163,13 @@ void lutil_log_int( #ifdef LDAP_SYSLOG /* we're configured to use syslog */ if( use_syslog ) { +#ifdef HAVE_VSYSLOG vsyslog( debug2syslog(level), fmt, vl ); +#else + char data[4096]; + vsnprintf( data, sizeof(data), fmt, vl ); + syslog( debug2syslog(level), data ); +#endif return; } #endif @@ -305,11 +310,7 @@ void (lutil_debug)( int debug, int level, const char *fmt, ... ) #endif va_start( vl, fmt ); -#ifdef HAVE_VSNPRINTF vsnprintf( buffer, sizeof(buffer), fmt, vl ); -#else - vsprintf( buffer, fmt, vl ); -#endif buffer[sizeof(buffer)-1] = '\0'; if( log_file != NULL ) { @@ -317,6 +318,6 @@ void (lutil_debug)( int debug, int level, const char *fmt, ... ) fflush( log_file ); } - fputs( buffer, stderr ); + fputs( buffer, stderr ); va_end( vl ); }