From a52bd265203956da0f2ff0bf2f16a546ad9210bc Mon Sep 17 00:00:00 2001 From: Nicky Date: Tue, 2 Apr 2013 01:55:26 +0200 Subject: [PATCH] Work around multithreading issue in ndFile::isExist. --- indra/llcommon/nd/ndfile.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/indra/llcommon/nd/ndfile.cpp b/indra/llcommon/nd/ndfile.cpp index 5a29a3628b..16a69ebf3d 100644 --- a/indra/llcommon/nd/ndfile.cpp +++ b/indra/llcommon/nd/ndfile.cpp @@ -220,11 +220,12 @@ namespace nd bool ndFile::isExist(const std::string& filename, ndVolatileAPRPool* pool, apr_int32_t flags) { - FILE *pFile = LLFile::fopen( filename, nd::aprhelper::ndConvertOpenFlags( flags, filename ) ); - if( pFile ) - LLFile::close( pFile ); - - return 0 != pFile; + llstat oStat; + int nRes = LLFile::stat( filename, &oStat ); + if( 0 == nRes ) + return S_ISREG( oStat.st_mode ); + + return false; } S32 ndFile::size(const std::string& aFilename, ndVolatileAPRPool* pool)