Boost logo

Boost-Commit :

From: Frank.Birbacher_at_[hidden]
Date: 2007-08-23 21:22:55


Author: birbacher
Date: 2007-08-23 21:22:55 EDT (Thu, 23 Aug 2007)
New Revision: 38879
URL: http://svn.boost.org/trac/boost/changeset/38879

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

Modified: sandbox-branches/birbacher/fix_iostreams/libs/iostreams/src/file_descriptor.cpp
==============================================================================
--- sandbox-branches/birbacher/fix_iostreams/libs/iostreams/src/file_descriptor.cpp (original)
+++ sandbox-branches/birbacher/fix_iostreams/libs/iostreams/src/file_descriptor.cpp 2007-08-23 21:22:55 EDT (Thu, 23 Aug 2007)
@@ -159,8 +159,10 @@
 #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;
@@ -192,7 +194,8 @@
                                   way == BOOST_IOS::cur ?
                                     FILE_CURRENT :
                                     FILE_END );
- if (::GetLastError() != NO_ERROR) {
+ if (dwResultLow == INVALID_SET_FILE_POINTER
+ && ::GetLastError() != NO_ERROR) {
             throw detail::bad_seek();
         } else {
            return offset_to_position((lDistanceToMoveHigh << 32) + dwResultLow);


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