diff options
author | Andrew Waterman <andrew@sifive.com> | 2018-12-19 02:30:09 -0800 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2018-12-19 02:31:08 -0800 |
commit | c20d84c6f3f8f38f5624c31078d60d7fb1298eee (patch) | |
tree | ff27b214277bdfb74dccd00c5872ca001b9b5500 | |
parent | ba04fcfd1cd928c0ac6fd2c09157f56ea38a65b3 (diff) | |
download | riscv-isa-sim-c20d84c6f3f8f38f5624c31078d60d7fb1298eee.zip riscv-isa-sim-c20d84c6f3f8f38f5624c31078d60d7fb1298eee.tar.gz riscv-isa-sim-c20d84c6f3f8f38f5624c31078d60d7fb1298eee.tar.bz2 |
Flush I/O buffers before forking
This prevents duplicate I/Os to buffered streams early in the program.
-rw-r--r-- | riscv/dts.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/riscv/dts.cc b/riscv/dts.cc index b8a5f9d..cea33ba 100644 --- a/riscv/dts.cc +++ b/riscv/dts.cc @@ -80,6 +80,7 @@ std::string dts_compile(const std::string& dts) int dts_pipe[2]; pid_t dts_pid; + fflush(NULL); // flush stdout/stderr before forking if (pipe(dts_pipe) != 0 || (dts_pid = fork()) < 0) { std::cerr << "Failed to fork dts child: " << strerror(errno) << std::endl; exit(1); |