From c5fb5593ac482ad30baf3748caa6959da84476ac Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Sun, 6 May 2007 17:59:11 +0000 Subject: [PATCH] If two threads call vssprintf at the same time, it is possible for bInitialized to be set before actually setting bExactSizeSupported. Set bInitialized after setting bExactSizeSupported to avoid this. --- stepmania/src/RageUtil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 422ffde88a..27bc6402c7 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -318,9 +318,9 @@ RString vssprintf( const char *szFormat, va_list argList ) /* Some systems return the actual size required when snprintf * doesn't have enough space. This lets us avoid wasting time * iterating, and wasting memory. */ - bInitialized = true; char ignore; bExactSizeSupported = ( snprintf( &ignore, 0, "Hello World" ) == 11 ); + bInitialized = true; } if( bExactSizeSupported )