aboutsummaryrefslogtreecommitdiffhomepage
path: root/exec.cpp
diff options
context:
space:
mode:
authorGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-01-15 15:37:33 +0800
committerGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-01-17 14:58:53 +0800
commit6f35792c74612f4b754125a5cfe9c96baa7854b9 (patch)
treeee721ca7ce434f77e80722eb208e0466e17b5a28 /exec.cpp
parentf1b375b042ad1564d00645579a54bb28ba3e30d1 (diff)
Split out io_fd_t
Diffstat (limited to 'exec.cpp')
-rw-r--r--exec.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/exec.cpp b/exec.cpp
index e72a787f..2aa13dc1 100644
--- a/exec.cpp
+++ b/exec.cpp
@@ -406,11 +406,6 @@ static bool io_transmogrify(const io_chain_t &in_chain, io_chain_t &out_chain, s
*/
case IO_FILE:
{
- out.reset(new io_data_t());
- out->fd = in->fd;
- out->io_mode = IO_FD;
- out->param2.close_old = 1;
-
int fd;
if ((fd=open(in->filename_cstr, in->param2.flags, OPEN_MASK))==-1)
{
@@ -424,7 +419,7 @@ static bool io_transmogrify(const io_chain_t &in_chain, io_chain_t &out_chain, s
}
opened_fds.push_back(fd);
- out->param1.old_fd = fd;
+ out.reset(new io_fd_t(in->fd, fd, true));
break;
}
@@ -852,7 +847,8 @@ void exec(parser_t &parser, job_t *j)
case IO_FD:
{
- builtin_stdin = in->param1.old_fd;
+ CAST_INIT(const io_fd_t *, in_fd, in.get());
+ builtin_stdin = in_fd->old_fd;
break;
}
case IO_PIPE: