Fix missing error code in conditional_sync

This commit is contained in:
mandreyel 2018-11-07 11:08:34 +01:00
parent d33a0d567f
commit 0da3002815
2 changed files with 9 additions and 2 deletions

View File

@ -334,7 +334,7 @@ void basic_mmap<AccessMode, ByteT>::sync(std::error_code& error)
return;
}
if(data() != nullptr)
if(data())
{
#ifdef _WIN32
if(::FlushViewOfFile(get_mapping_start(), mapped_length_) == 0

View File

@ -372,7 +372,14 @@ private:
*/
template<access_mode A = AccessMode,
typename = typename std::enable_if<A == access_mode::write>::type>
void conditional_sync() { sync(); }
void conditional_sync()
{
// This is invoked from the destructor, so not much we can do about
// failures here.
std::error_code ec;
sync(ec);
}
template<access_mode A = AccessMode>
typename std::enable_if<A == access_mode::read, void>::type conditional_sync() {}
};