mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-19 11:54:22 -04:00
fixed bug causing call to closedir on invalid handle
This commit is contained in:
parent
96b333d67e
commit
e03bd6cbac
2 changed files with 8 additions and 2 deletions
|
@ -44,10 +44,10 @@ FolderIterator::FolderIterator(const std::string& folderName)
|
||||||
utf16Name += L"/*.*";
|
utf16Name += L"/*.*";
|
||||||
|
|
||||||
handle = FindFirstFileW(utf16Name.c_str(), &fileInfo);
|
handle = FindFirstFileW(utf16Name.c_str(), &fileInfo);
|
||||||
validity = handle != INVALID_HANDLE_VALUE;
|
is_open = validity = handle != INVALID_HANDLE_VALUE;
|
||||||
#else
|
#else
|
||||||
handle = opendir(folderName.c_str());
|
handle = opendir(folderName.c_str());
|
||||||
validity = handle != NULL;
|
is_open = validity = handle != NULL;
|
||||||
next();
|
next();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -156,6 +156,11 @@ bool FolderIterator::closedir()
|
||||||
{
|
{
|
||||||
validity = false;
|
validity = false;
|
||||||
|
|
||||||
|
if(!is_open)
|
||||||
|
return true ;
|
||||||
|
|
||||||
|
is_open = false ;
|
||||||
|
|
||||||
#ifdef WINDOWS_SYS
|
#ifdef WINDOWS_SYS
|
||||||
return FindClose(handle) != 0;
|
return FindClose(handle) != 0;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -50,6 +50,7 @@ public:
|
||||||
time_t file_modtime() ;
|
time_t file_modtime() ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool is_open;
|
||||||
bool validity;
|
bool validity;
|
||||||
|
|
||||||
#ifdef WINDOWS_SYS
|
#ifdef WINDOWS_SYS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue