Opened 16 years ago

Closed 15 years ago

#856 closed Bugs (fixed)

iostreams file_descriptor::write fails under Win32

Reported by: nobody Owned by: Jonathan Turkanis
Milestone: Component: iostreams
Version: None Severity: Problem
Keywords: Cc:

Description

in 1.33.1, file_descriptor::write(), append mode implemented as

#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)
                throw detail::bad_seek();


it is common mistake to call GetLastError() without checking function return value first. MSDN has special note for SetFilePointer():

"Note  If the function returns a value other than INVALID_SET_FILE_POINTER, the call to SetFilePointer has succeeded. You do not need to call GetLastError."

So, file_descriptor::write() fails, if there is old uncleaned "last" error

Regards,

valeri.antonov@gmail.com

Change History (6)

comment:1 by gmsb, 16 years ago

Logged In: YES 
user_id=271167
Originator: NO

This is the same issue as in the comment on patches #1452698.

How can we speed up when this and other Boost.Iostreams patches are applied?


comment:2 by Daryle Walker, 15 years ago

Component: Noneiostreams
Severity: Problem

comment:3 by Frank Birbacher, 15 years ago

Bug noted and addressed in [38879]. Still needs approval of maintainer.

comment:4 by anonymous, 15 years ago

Is this a duplicate of ticket #699

comment:5 by Jonathan Turkanis, 15 years ago

this is not a duplicate of #699; #699 deals with mapped_file, not file_descriptor

comment:6 by Jonathan Turkanis, 15 years ago

Resolution: Nonefixed
Status: assignedclosed

Fixed in [42266]

Note: See TracTickets for help on using tickets.