diff options
Diffstat (limited to 'indra/llvfs')
-rw-r--r-- | indra/llvfs/CMakeLists.txt | 10 | ||||
-rw-r--r-- | indra/llvfs/lldir.cpp | 7 | ||||
-rw-r--r-- | indra/llvfs/lldiriterator.cpp | 20 | ||||
-rw-r--r-- | indra/llvfs/lllfsthread.cpp | 2 | ||||
-rw-r--r-- | indra/llvfs/llvfsthread.cpp | 2 |
5 files changed, 30 insertions, 11 deletions
diff --git a/indra/llvfs/CMakeLists.txt b/indra/llvfs/CMakeLists.txt index 2c581cf8d6..a819d12861 100644 --- a/indra/llvfs/CMakeLists.txt +++ b/indra/llvfs/CMakeLists.txt @@ -83,13 +83,13 @@ if (LL_TESTS) include(LLAddBuildTest) # UNIT TESTS SET(llvfs_TEST_SOURCE_FILES - lldiriterator.cpp - ) + lldiriterator.cpp + ) set_source_files_properties(lldiriterator.cpp - PROPERTIES - LL_TEST_ADDITIONAL_LIBRARIES "${vfs_BOOST_LIBRARIES}" - ) + PROPERTIES + LL_TEST_ADDITIONAL_LIBRARIES "${vfs_BOOST_LIBRARIES}" + ) LL_ADD_PROJECT_UNIT_TESTS(llvfs "${llvfs_TEST_SOURCE_FILES}") # INTEGRATION TESTS diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index f3ac17d612..32d081d552 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -86,6 +86,13 @@ S32 LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask) std::string fullpath; S32 result; + // File masks starting with "/" will match nothing, so we consider them invalid. + if (LLStringUtil::startsWith(mask, getDirDelimiter())) + { + llwarns << "Invalid file mask: " << mask << llendl; + llassert(!"Invalid file mask"); + } + LLDirIterator iter(dirname, mask); while (iter.next(filename)) { diff --git a/indra/llvfs/lldiriterator.cpp b/indra/llvfs/lldiriterator.cpp index 25550321f0..ff92cbb7fd 100644 --- a/indra/llvfs/lldiriterator.cpp +++ b/indra/llvfs/lldiriterator.cpp @@ -52,8 +52,20 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) { fs::path dir_path(dirname); - // Check if path exists. - if (!fs::exists(dir_path)) + bool is_dir = false; + + // Check if path is a directory. + try + { + is_dir = fs::is_directory(dir_path); + } + catch (fs::basic_filesystem_error<fs::path>& e) + { + llwarns << e.what() << llendl; + return; + } + + if (!is_dir) { llwarns << "Invalid path: \"" << dir_path.string() << "\"" << llendl; return; @@ -66,7 +78,7 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) } catch (fs::basic_filesystem_error<fs::path>& e) { - llerrs << e.what() << llendl; + llwarns << e.what() << llendl; return; } @@ -82,7 +94,7 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) } catch (boost::regex_error& e) { - llerrs << "\"" << exp << "\" is not a valid regular expression: " + llwarns << "\"" << exp << "\" is not a valid regular expression: " << e.what() << llendl; return; } diff --git a/indra/llvfs/lllfsthread.cpp b/indra/llvfs/lllfsthread.cpp index 3d3ed9f6d4..073b1af2a1 100644 --- a/indra/llvfs/lllfsthread.cpp +++ b/indra/llvfs/lllfsthread.cpp @@ -45,7 +45,7 @@ void LLLFSThread::initClass(bool local_is_threaded) //static S32 LLLFSThread::updateClass(U32 ms_elapsed) { - sLocal->update(ms_elapsed); + sLocal->update((F32)ms_elapsed); return sLocal->getPending(); } diff --git a/indra/llvfs/llvfsthread.cpp b/indra/llvfs/llvfsthread.cpp index 254f8b55ba..a57e2b15ab 100644 --- a/indra/llvfs/llvfsthread.cpp +++ b/indra/llvfs/llvfsthread.cpp @@ -46,7 +46,7 @@ void LLVFSThread::initClass(bool local_is_threaded) //static S32 LLVFSThread::updateClass(U32 ms_elapsed) { - sLocal->update(ms_elapsed); + sLocal->update((F32)ms_elapsed); return sLocal->getPending(); } |