mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
fuzz: Re-implement read_stdin
in portable way
This commit is contained in:
parent
e31956980e
commit
09f5a74198
1 changed files with 3 additions and 4 deletions
|
@ -25,7 +25,6 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <unistd.h>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
@ -135,9 +134,9 @@ void initialize()
|
|||
#if defined(PROVIDE_FUZZ_MAIN_FUNCTION)
|
||||
static bool read_stdin(std::vector<uint8_t>& data)
|
||||
{
|
||||
uint8_t buffer[1024];
|
||||
ssize_t length = 0;
|
||||
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) {
|
||||
data.insert(data.end(), buffer, buffer + length);
|
||||
}
|
||||
return length == 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue