[PATCH] D28977: [libFuzzer] Implement TmpDir() for Windows.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 10:26:05 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL293516: [libFuzzer] Implement TmpDir() for Windows. (authored by mpividori).

Changed prior to commit:
  https://reviews.llvm.org/D28977?vs=86304&id=86307#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28977

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


Index: llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
+++ llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
@@ -287,7 +287,17 @@
   return FileName.substr(0, LocationLen + DirLen);
 }
 
-std::string TmpDir() { return "TODO: implement TmpDir"; }
+std::string TmpDir() {
+  std::string Tmp;
+  Tmp.resize(MAX_PATH + 1);
+  DWORD Size = GetTempPathA(Tmp.size(), &Tmp[0]);
+  if (Size == 0) {
+    Printf("Couldn't get Tmp path.\n");
+    exit(1);
+  }
+  Tmp.resize(Size);
+  return Tmp;
+}
 
 bool IsInterestingCoverageFile(const std::string &FileName) {
   if (FileName.find("Program Files") != std::string::npos)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28977.86307.patch
Type: text/x-patch
Size: 714 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170130/447dd280/attachment-0001.bin>


More information about the llvm-commits mailing list