From: Vyacheslav Reutskiy Date: Wed, 23 Nov 2016 13:43:40 +0000 (+0200) Subject: eina_file_win32: close handler in case of error X-Git-Tag: accepted/tizen/common/20170102.152350~140 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b85bd2f9dd32c2433a2575efd98e9e25309f17b;p=platform%2Fupstream%2Fefl.git 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. Change-Id: I178d99e2a29ef8021b35ec1e17068021363ac1f4 Signed-off-by: Vyacheslav Reutskiy --- diff --git a/src/lib/eina/eina_file_win32.c b/src/lib/eina/eina_file_win32.c index 2df5956..54b5d90 100644 --- a/src/lib/eina/eina_file_win32.c +++ b/src/lib/eina/eina_file_win32.c @@ -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;