Boost logo

Boost-Commit :

From: technews_at_[hidden]
Date: 2008-02-13 00:43:40


Author: turkanis
Date: 2008-02-13 00:43:39 EST (Wed, 13 Feb 2008)
New Revision: 43239
URL: http://svn.boost.org/trac/boost/changeset/43239

Log:
fixed return value of read(), to correctly handle eof
Text files modified:
   trunk/libs/iostreams/src/file_descriptor.cpp | 2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

Modified: trunk/libs/iostreams/src/file_descriptor.cpp
==============================================================================
--- trunk/libs/iostreams/src/file_descriptor.cpp (original)
+++ trunk/libs/iostreams/src/file_descriptor.cpp 2008-02-13 00:43:39 EST (Wed, 13 Feb 2008)
@@ -173,7 +173,7 @@
     DWORD result;
     if (!::ReadFile(pimpl_->handle_, s, n, &result, NULL))
         throw detail::bad_read();
- return static_cast<std::streamsize>(result);
+ return result == 0 ? -1 : static_cast<std::streamsize>(result);
 #else // #ifdef BOOST_IOSTREAMS_WINDOWS
     errno = 0;
     std::streamsize result = BOOST_IOSTREAMS_FD_READ(pimpl_->handle_, s, n);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk