io_win32: test return of GetFileSize for errors
This commit is contained in:
parent
058a86ba05
commit
676154d652
@ -69,7 +69,11 @@ mapped_file::mapped_file (::cruft::win32::handle &&src,
|
|||||||
// I would rather perform checks on filesize after mapping, but mapping
|
// I would rather perform checks on filesize after mapping, but mapping
|
||||||
// requires a check for empty files before we perform the mapping to
|
// requires a check for empty files before we perform the mapping to
|
||||||
// detect errors it throws in that specific situation.
|
// detect errors it throws in that specific situation.
|
||||||
DWORD hi_size, lo_size = GetFileSize (m_file, &hi_size);
|
DWORD hi_size;
|
||||||
|
DWORD lo_size = GetFileSize (m_file, &hi_size);
|
||||||
|
if (lo_size == INVALID_FILE_SIZE)
|
||||||
|
::cruft::win32::error::throw_code ();
|
||||||
|
|
||||||
m_size = static_cast<uint64_t> (hi_size) << 32 | lo_size;
|
m_size = static_cast<uint64_t> (hi_size) << 32 | lo_size;
|
||||||
|
|
||||||
m_mapping.reset (
|
m_mapping.reset (
|
||||||
|
Loading…
Reference in New Issue
Block a user