[PATCH] D29548: [libFuzzer] Fix close_fd_mask.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 16:14:45 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL294388: [libFuzzer] Properly use Handle instead of FD on Windows. (authored by mpividori).

Changed prior to commit:
  https://reviews.llvm.org/D29548?vs=87248&id=87555#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29548

Files:
  llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
  llvm/trunk/lib/Fuzzer/FuzzerIO.h
  llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp
  llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp


Index: llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
+++ llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
@@ -96,7 +96,8 @@
     if (NewOutputFile) {
       OutputFile = NewOutputFile;
       if (EF->__sanitizer_set_report_fd)
-        EF->__sanitizer_set_report_fd(reinterpret_cast<void *>(OutputFd));
+        EF->__sanitizer_set_report_fd(
+            reinterpret_cast<void *>(GetHandleFromFd(OutputFd)));
       DiscardOutput(2);
     }
   }
Index: llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp
+++ llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp
@@ -83,6 +83,10 @@
   fclose(Temp);
 }
 
+intptr_t GetHandleFromFd(int fd) {
+  return static_cast<intptr_t>(fd);
+}
+
 std::string DirName(const std::string &FileName) {
   char *Tmp = new char[FileName.size() + 1];
   memcpy(Tmp, FileName.c_str(), FileName.size() + 1);
Index: llvm/trunk/lib/Fuzzer/FuzzerIO.h
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIO.h
+++ llvm/trunk/lib/Fuzzer/FuzzerIO.h
@@ -69,6 +69,8 @@
 
 void DiscardOutput(int Fd);
 
+intptr_t GetHandleFromFd(int fd);
+
 }  // namespace fuzzer
 
 #endif  // LLVM_FUZZER_IO_H
Index: llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
===================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
+++ llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
@@ -149,6 +149,10 @@
   fclose(Temp);
 }
 
+intptr_t GetHandleFromFd(int fd) {
+  return _get_osfhandle(fd);
+}
+
 static bool IsSeparator(char C) {
   return C == '\\' || C == '/';
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29548.87555.patch
Type: text/x-patch
Size: 1723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170208/98ff7cd2/attachment.bin>


More information about the llvm-commits mailing list