[Boost-bugs] [Boost C++ Libraries] #2817: boost::iostreams::file_descriptor::is_open() implemented incorrectly

Subject: [Boost-bugs] [Boost C++ Libraries] #2817: boost::iostreams::file_descriptor::is_open() implemented incorrectly
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-03-02 22:20:08


#2817: boost::iostreams::file_descriptor::is_open() implemented incorrectly
-------------------------------------+--------------------------------------
 Reporter: boost_at_[hidden] | Owner: turkanis
     Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: iostreams
  Version: Boost 1.38.0 | Severity: Problem
 Keywords: file_descriptor is_open |
-------------------------------------+--------------------------------------
 On line 70 of file_descriptor.hpp the is_open() function checks if flags
 are zero to determine if the file descriptor is open:

   bool is_open() const { return pimpl_->flags_ != 0; }

 pimpl_->flags_ is always zero unless close_on_exit is enabled. So
 close_on_exit is the only thing that determines what is_open() will
 return. I believe the code should be:

 #ifdef BOOST_IOSTREAMS_WINDOWS
   bool is_open() const { return pimpl_->handle_ !=
 reinterpret_cast<handle_type>(1); }
 #else
   bool is_open() const { return pimpl_->handle_ != -1; }
 #endif

 Thanks!

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2817>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC