[llvm] r292741 - [libFuzzer] Fix ListFilesInDirRecursive() to do the same for Posix and Windows.

Marcos Pividori via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 21 17:58:36 PST 2017


Author: mpividori
Date: Sat Jan 21 19:58:36 2017
New Revision: 292741

URL: http://llvm.org/viewvc/llvm-project?rev=292741&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp

Modified: llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp?rev=292741&r1=292740&r2=292741&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp Sat Jan 21 19:58:36 2017
@@ -89,8 +89,10 @@ void ListFilesInDirRecursive(const std::
   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 {




More information about the llvm-commits mailing list