aboutsummaryrefslogtreecommitdiffhomepage
path: root/io.cpp
diff options
context:
space:
mode:
authorGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-02-04 20:07:16 +0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-02-11 22:05:47 -0800
commit3f9706a7f350fcac43fc389b0b52b3601269e2e9 (patch)
tree7bc25f1a6bbbdf66ec56aaf5bc2c321dda45f879 /io.cpp
parent41fc3bcb748efc20e36160f5c361882c854f4baf (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.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/io.cpp b/io.cpp
index f1d664f8..669752fd 100644
--- a/io.cpp
+++ b/io.cpp
@@ -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)
{