[llvm] r247066 - [libFuzzer] be more robust when dealing with files on disk (e.g. don't crash if a file was there but disappeared)

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 13:36:33 PDT 2015


Author: kcc
Date: Tue Sep  8 15:36:33 2015
New Revision: 247066

URL: http://llvm.org/viewvc/llvm-project?rev=247066&view=rev
Log:
[libFuzzer] be more robust when dealing with files on disk (e.g. don't crash if a file was there but disappeared)

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

Modified: llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIO.cpp?rev=247066&r1=247065&r2=247066&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIO.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIO.cpp Tue Sep  8 15:36:33 2015
@@ -21,10 +21,8 @@ namespace fuzzer {
 
 static long GetEpoch(const std::string &Path) {
   struct stat St;
-  if (stat(Path.c_str(), &St)) {
-    Printf("Can not stat: %s; exiting\n", Path.c_str());
-    exit(1);
-  }
+  if (stat(Path.c_str(), &St))
+    return 0;  // Can't stat, be conservative.
   return St.st_mtime;
 }
 




More information about the llvm-commits mailing list