mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 04:47:29 +02:00
Fix file open with append/append_existing flag on Windows
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
* Fix file open with append/append_existing flag on Windows.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 323:
|
||||
|
||||
* Fix clang-cl UTF8 path handling for `file_win32`.
|
||||
|
@ -198,11 +198,28 @@ open(char const* path, file_mode mode, error_code& ec)
|
||||
creation_disposition,
|
||||
flags_and_attributes,
|
||||
NULL);
|
||||
if(h_ == boost::winapi::INVALID_HANDLE_VALUE_)
|
||||
if (h_ == boost::winapi::INVALID_HANDLE_VALUE_)
|
||||
{
|
||||
ec.assign(boost::winapi::GetLastError(),
|
||||
system_category());
|
||||
else
|
||||
ec = {};
|
||||
return;
|
||||
}
|
||||
if (mode == file_mode::append ||
|
||||
mode == file_mode::append_existing)
|
||||
{
|
||||
boost::winapi::LARGE_INTEGER_ in;
|
||||
in.QuadPart = 0;
|
||||
if (!detail::set_file_pointer_ex(h_, in, 0,
|
||||
boost::winapi::FILE_END_))
|
||||
{
|
||||
ec.assign(boost::winapi::GetLastError(),
|
||||
system_category());
|
||||
boost::winapi::CloseHandle(h_);
|
||||
h_ = boost::winapi::INVALID_HANDLE_VALUE_;
|
||||
return;
|
||||
}
|
||||
}
|
||||
ec = {};
|
||||
}
|
||||
|
||||
std::uint64_t
|
||||
|
Reference in New Issue
Block a user