diff options
Diffstat (limited to 'include/llfio/v2.0/detail/impl/posix/map_handle.ipp')
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/map_handle.ipp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/llfio/v2.0/detail/impl/posix/map_handle.ipp b/include/llfio/v2.0/detail/impl/posix/map_handle.ipp index 4f3aeabf..bf676d4a 100644 --- a/include/llfio/v2.0/detail/impl/posix/map_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/map_handle.ipp @@ -439,14 +439,17 @@ result<map_handle::size_type> map_handle::truncate(size_type newsize, bool permi extent_type length = _length; if(_section != nullptr) { - OUTCOME_TRY(auto &&length_, _section->length()); // length of the backing file - length = length_; + OUTCOME_TRY(length, _section->length()); // length of the backing file } auto _newsize = utils::round_up_to_page_size(newsize, _pagesize); if(_newsize == _reservation) { return success(); } + if(_section == nullptr) + { + length = _newsize; // newsize, but rounded up + } // If wiping the map ... if(newsize == 0) { |