mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-25 23:06:10 -05:00
fixed bug causing call to closedir on invalid handle
This commit is contained in:
parent
96b333d67e
commit
e03bd6cbac
@ -44,10 +44,10 @@ FolderIterator::FolderIterator(const std::string& folderName)
|
||||
utf16Name += L"/*.*";
|
||||
|
||||
handle = FindFirstFileW(utf16Name.c_str(), &fileInfo);
|
||||
validity = handle != INVALID_HANDLE_VALUE;
|
||||
is_open = validity = handle != INVALID_HANDLE_VALUE;
|
||||
#else
|
||||
handle = opendir(folderName.c_str());
|
||||
validity = handle != NULL;
|
||||
is_open = validity = handle != NULL;
|
||||
next();
|
||||
#endif
|
||||
}
|
||||
@ -156,6 +156,11 @@ bool FolderIterator::closedir()
|
||||
{
|
||||
validity = false;
|
||||
|
||||
if(!is_open)
|
||||
return true ;
|
||||
|
||||
is_open = false ;
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
return FindClose(handle) != 0;
|
||||
#else
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
time_t file_modtime() ;
|
||||
|
||||
private:
|
||||
bool is_open;
|
||||
bool validity;
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
|
Loading…
x
Reference in New Issue
Block a user