From: Marcos Pividori Date: Sun, 22 Jan 2017 01:58:36 +0000 (+0000) Subject: [libFuzzer] Fix ListFilesInDirRecursive() to do the same for Posix and Windows. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6820da1473b39c897945fce2e121044e260e11ed;p=llvm [libFuzzer] Fix ListFilesInDirRecursive() to do the same for Posix and Windows. Update `ListFilesInDirRecursive` implementation on Windows to have the same behavior than for Posix, when the directory doesn't exists and when it is empty. Differential Revision: https://reviews.llvm.org/D28711 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292741 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Fuzzer/FuzzerIOWindows.cpp b/lib/Fuzzer/FuzzerIOWindows.cpp index e2a67973386..983cb6c2e4a 100644 --- a/lib/Fuzzer/FuzzerIOWindows.cpp +++ b/lib/Fuzzer/FuzzerIOWindows.cpp @@ -89,8 +89,10 @@ void ListFilesInDirRecursive(const std::string &Dir, long *Epoch, HANDLE FindHandle(FindFirstFileA(Path.c_str(), &FindInfo)); if (FindHandle == INVALID_HANDLE_VALUE) { - Printf("No file found in: %s.\n", Dir.c_str()); - return; + if (GetLastError() == ERROR_FILE_NOT_FOUND) + return; + Printf("No such directory: %s; exiting\n", Dir.c_str()); + exit(1); } do {