Added error return in GetFileAttributesExA.
authorArmin Novak <armin.novak@thincast.com>
Tue, 11 Apr 2017 09:32:45 +0000 (11:32 +0200)
committerArmin Novak <armin.novak@thincast.com>
Tue, 11 Apr 2017 09:34:11 +0000 (11:34 +0200)
winpr/libwinpr/file/generic.c

index d6ab277..7d7be52 100644 (file)
@@ -475,8 +475,10 @@ BOOL WINAPI GetFileAttributesExA(LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfo
        WIN32_FIND_DATAA findFileData;
        HANDLE hFind;
 
-       if ((hFind = FindFirstFileA(lpFileName, &findFileData)) != INVALID_HANDLE_VALUE)
-               FindClose(hFind);
+       if ((hFind = FindFirstFileA(lpFileName, &findFileData)) == INVALID_HANDLE_VALUE)
+               return FALSE;
+
+       FindClose(hFind);
 
        fd->dwFileAttributes = findFileData.dwFileAttributes;
        fd->ftCreationTime = findFileData.ftCreationTime;