Skip to content

Commit

Permalink
fd_t: Update internal length if resize succeeds
Browse files Browse the repository at this point in the history
Fixes #65
  • Loading branch information
amyspark committed Jun 5, 2023
1 parent 80ad63f commit c410e00
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion substrate/fd
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ namespace substrate
}

SUBSTRATE_NO_DISCARD(inline bool resize(const off_t newSize) const noexcept)
{ return internal::fdtruncate(fd, newSize) == 0; }
{
if (internal::fdtruncate(fd, newSize) != 0)
return false;

_length = newSize;
return true;
}

SUBSTRATE_NO_DISCARD(inline mmap_t map(const int32_t prot, const int flags = MAP_SHARED) noexcept)
{
Expand Down

0 comments on commit c410e00

Please sign in to comment.