summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerIO.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerIO.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerIO.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerIO.cpp b/llvm/lib/Fuzzer/FuzzerIO.cpp
index c6636c86818..85703c81841 100644
--- a/llvm/lib/Fuzzer/FuzzerIO.cpp
+++ b/llvm/lib/Fuzzer/FuzzerIO.cpp
@@ -9,13 +9,13 @@
// IO functions.
//===----------------------------------------------------------------------===//
#include "FuzzerInternal.h"
-#include <iostream>
#include <iterator>
#include <fstream>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <cstdio>
namespace fuzzer {
@@ -56,9 +56,7 @@ std::string FileToString(const std::string &Path) {
}
void CopyFileToErr(const std::string &Path) {
- std::ifstream T(Path);
- std::copy(std::istreambuf_iterator<char>(T), std::istreambuf_iterator<char>(),
- std::ostream_iterator<char>(std::cerr, ""));
+ Printf("%s", FileToString(Path).c_str());
}
void WriteToFile(const Unit &U, const std::string &Path) {
@@ -86,4 +84,11 @@ void PrintFileAsBase64(const std::string &Path) {
ExecuteCommand(Cmd);
}
+void Printf(const char *Fmt, ...) {
+ va_list ap;
+ va_start(ap, Fmt);
+ vfprintf(stderr, Fmt, ap);
+ va_end(ap);
+}
+
} // namespace fuzzer
OpenPOWER on IntegriCloud