diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2013-02-22 13:20:27 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2013-02-22 13:20:27 -0800 |
commit | 9f8fe3d5e37f0a7d2c6df56e42b6d9ee3b64e737 (patch) | |
tree | 4e61a4a06a59a952eb21df8a3cf87847cfcd6529 /io.cpp | |
parent | 3c8c8a7559999a30d4f3de63b2c7122409b1fdb6 (diff) |
Hopeful fix to avoid forking for certain builtins like echo when they have an input redirection only
Diffstat (limited to 'io.cpp')
-rw-r--r-- | io.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -209,7 +209,7 @@ void io_chain_t::push_back(const shared_ptr<io_data_t> &element) { // Ensure we never push back NULL assert(element.get() != NULL); - std::vector<shared_ptr<io_data_t> >:: push_back(element); + std::vector<shared_ptr<io_data_t> >::push_back(element); } void io_remove(io_chain_t &list, const shared_ptr<const io_data_t> &element) @@ -229,8 +229,15 @@ void io_print(const io_chain_t &chain) for (size_t i=0; i < chain.size(); i++) { const shared_ptr<const io_data_t> &io = chain.at(i); - fprintf(stderr, "\t%lu: fd:%d, ", (unsigned long)i, io->fd); - io->print(); + if (io.get() == NULL) + { + fprintf(stderr, "\t(null)\n"); + } + else + { + fprintf(stderr, "\t%lu: fd:%d, ", (unsigned long)i, io->fd); + io->print(); + } } } |