Skip to content

Commit

Permalink
fix(ringbuf interface): handle ftruncate return value
Browse files Browse the repository at this point in the history
The return value is marked "warn_unused" on some systems, so handle it.
  • Loading branch information
cvonelm committed Dec 5, 2024
1 parent c92ae69 commit 6d3c2b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/lo2s/ringbuf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ class ShmRingbuf
if (create)
{
size = pagesize * pages;
ftruncate(fd_, size + sysconf(_SC_PAGESIZE));
if (ftruncate(fd_, size + sysconf(_SC_PAGESIZE)) == -1)
{
close(fd_);
throw std::system_error(errno, std::system_category());
}
}
else
{
Expand Down

0 comments on commit 6d3c2b7

Please sign in to comment.