eina_file_win32: close handler in case of error

Func _eina_file_win32_first_file try to find the first file in directory
but if any file not found the file handler stay open, and func will
return error. But in this case while handle is open impossible to do
any actions. For example call eina_file_ls for empty folder, func will
return error and fold folder open. And if we try to remove this folder
Windows only mark it to delete, and remove it after the process is
complete.

Solution: close handler in error case.
This commit is contained in:
Vyacheslav Reutskiy 2016-11-23 15:43:40 +02:00
parent 164ece9e3f
commit 56c202614b
1 changed files with 4 additions and 1 deletions

View File

@ -160,7 +160,10 @@ _eina_file_win32_first_file(const char *dir, WIN32_FIND_DATA *fd)
((fd->cFileName[1] == '.') && (fd->cFileName[2] == '\0'))))
{
if (!FindNextFile(h, fd))
return INVALID_HANDLE_VALUE;
{
FindClose(h);
return INVALID_HANDLE_VALUE;
}
}
return h;