diff options
author | 2013-02-04 20:07:16 +0800 | |
---|---|---|
committer | 2013-02-11 22:05:47 -0800 | |
commit | 3f9706a7f350fcac43fc389b0b52b3601269e2e9 (patch) | |
tree | 7bc25f1a6bbbdf66ec56aaf5bc2c321dda45f879 /io.cpp | |
parent | 41fc3bcb748efc20e36160f5c361882c854f4baf (diff) |
Make io_data_t::fd const
In exec(), pipe_{write,read} no longer get reused.
Diffstat (limited to 'io.cpp')
-rw-r--r-- | io.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -131,10 +131,14 @@ void io_buffer_t::read() } -io_buffer_t *io_buffer_t::create(bool is_input) +io_buffer_t *io_buffer_t::create(bool is_input, int fd) { bool success = true; - io_buffer_t *buffer_redirect = new io_buffer_t(is_input ? 0 : 1, is_input); + if (fd == -1) + { + fd = is_input ? 0 : 1; + } + io_buffer_t *buffer_redirect = new io_buffer_t(fd, is_input); if (exec_pipe(buffer_redirect->pipe_fd) == -1) { |