We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
read_stdin
1 parent e319569 commit 09f5a74Copy full SHA for 09f5a74
src/test/fuzz/fuzz.cpp
@@ -25,7 +25,6 @@
25
#include <memory>
26
#include <string>
27
#include <tuple>
28
-#include <unistd.h>
29
#include <utility>
30
#include <vector>
31
@@ -135,9 +134,9 @@ void initialize()
135
134
#if defined(PROVIDE_FUZZ_MAIN_FUNCTION)
136
static bool read_stdin(std::vector<uint8_t>& data)
137
{
138
- uint8_t buffer[1024];
139
- ssize_t length = 0;
140
- while ((length = read(STDIN_FILENO, buffer, 1024)) > 0) {
+ std::istream::char_type buffer[1024];
+ std::streamsize length;
+ while ((std::cin.read(buffer, 1024), length = std::cin.gcount()) > 0) {
141
data.insert(data.end(), buffer, buffer + length);
142
}
143
return length == 0;
0 commit comments