svn rev #25407: tools/gssmonger/trunk/gssmaggot/
ghudson@MIT.EDU
ghudson at MIT.EDU
Mon Oct 24 00:28:50 EDT 2011
http://src.mit.edu/fisheye/changelog/krb5/?cs=25407
Commit By: ghudson
Log Message:
Fix a stdarg violation in ServerSendLogEntry().
Use va_copy to avoid using the same va_arg list twice. Also use a
more useful portability construction for va_copy (should work on C99
platforms and on MSVC).
Changed Files:
U tools/gssmonger/trunk/gssmaggot/logging.c
Modified: tools/gssmonger/trunk/gssmaggot/logging.c
===================================================================
--- tools/gssmonger/trunk/gssmaggot/logging.c 2011-10-21 23:15:27 UTC (rev 25406)
+++ tools/gssmonger/trunk/gssmaggot/logging.c 2011-10-24 04:28:50 UTC (rev 25407)
@@ -73,6 +73,10 @@
#include "server.h"
#include "extend.h"
+#ifndef va_copy
+#define va_copy(a, b) ((a) = (b)) /* Works on Windows */
+#endif
+
/*++**************************************************************
NAME: ExpandArgsToBuffer
@@ -124,18 +128,15 @@
Buffer = (LPSTR) pvTmp;
- #ifdef __va_copy
- __va_copy(vaTmp, InVa);
- #else /* __va_copy */
- vaTmp = InVa;
- #endif /* __va_copy */
+ va_copy(vaTmp, InVa);
- Buffer[ SizeAttempt-1 ] = '\0';
+ Buffer[ SizeAttempt-1 ] = '\0';
vsnprintf( Buffer,
SizeAttempt,
fmt,
vaTmp );
+ va_end(vaTmp);
if ( '\0' == Buffer[ SizeAttempt -1 ] ) {
*ppBuffer = Buffer;
@@ -211,6 +212,7 @@
#ifdef HACK_AROUND_LINUX_ALLOCATOR_BUG
CHAR buffer[ 100 ];
#endif
+ va_list vaTmp;
{
const char *basename = strrchr(file, '/');
@@ -221,9 +223,10 @@
printf( "%s:%ld: ", basename, line );
}
+ va_copy(vaTmp, va);
StringLength = vfprintf( stdout,
fmt,
- va );
+ vaTmp );
printf( "\n" );
More information about the cvs-krb5
mailing list