asio::posix::stream_descriptor throws with redirected stdin

Hello, Please consider the program listed below. I compiled with the command "g++ test.cpp -lboost_system-mt" using GCC 4.5 on Gentoo linux with boost 1.48. When I invoke the program like this it works fine: cat test.cpp | ./a.out When I invoke the program like this it throws: ./a.out < test.cpp The exception thrown: terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error>
' what(): assign: Operation not permitted Aborted
Question: Why does the program throw when I redirect stdin to point to a file? Thank you, Chris //=== begin test.cpp === #include <boost/asio.hpp> int main() { boost::asio::io_service IoService; int Fd = ::dup(STDIN_FILENO); boost::asio::posix::stream_descriptor Stream(IoService, Fd); return 0; }
participants (1)
-
Chris Stankevitz