Boost logo

Boost-Commit :

From: technews_at_[hidden]
Date: 2007-12-21 22:51:36


Author: turkanis
Date: 2007-12-21 22:51:35 EST (Fri, 21 Dec 2007)
New Revision: 42237
URL: http://svn.boost.org/trac/boost/changeset/42237

Log:
Changed error checking on Windows API function. Adresses #856 (ported from sandbox-branches/birbacher/fix_iostreams)
Text files modified:
   branches/iostreams_dev/libs/iostreams/src/file_descriptor.cpp | 8 ++++++--
   1 files changed, 6 insertions(+), 2 deletions(-)

Modified: branches/iostreams_dev/libs/iostreams/src/file_descriptor.cpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/src/file_descriptor.cpp (original)
+++ branches/iostreams_dev/libs/iostreams/src/file_descriptor.cpp 2007-12-21 22:51:35 EST (Fri, 21 Dec 2007)
@@ -159,9 +159,13 @@
 #ifdef BOOST_IOSTREAMS_WINDOWS
     if (pimpl_->flags_ & impl::has_handle) {
         if (pimpl_->flags_ & impl::append) {
- ::SetFilePointer(pimpl_->handle_, 0, NULL, FILE_END);
- if (::GetLastError() != NO_ERROR)
+ DWORD const dwResult =
+ ::SetFilePointer(pimpl_->handle_, 0, NULL, FILE_END);
+ if ( dwResult == INVALID_SET_FILE_POINTER &&
+ ::GetLastError() != NO_ERROR )
+ {
                 throw detail::bad_seek();
+ }
         }
         DWORD ignore;
         if (!::WriteFile(pimpl_->handle_, s, n, &ignore, NULL))


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