]> granicus.if.org Git - llvm/commitdiff
[libFuzzer] Fix ListFilesInDirRecursive() to do the same for Posix and Windows.
authorMarcos Pividori <mpividori@google.com>
Sun, 22 Jan 2017 01:58:36 +0000 (01:58 +0000)
committerMarcos Pividori <mpividori@google.com>
Sun, 22 Jan 2017 01:58:36 +0000 (01:58 +0000)
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

lib/Fuzzer/FuzzerIOWindows.cpp

index e2a679733868e5d6215de6e80c57062ef1dce082..983cb6c2e4a125a577ff99878922f58171eccba3 100644 (file)
@@ -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 {