Skip to content

Commit

Permalink
- more defensive programming
Browse files Browse the repository at this point in the history
  • Loading branch information
aschnell committed Oct 21, 2024
1 parent 6a74818 commit 6e3a73f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion snapper/FileUtils.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) [2011-2014] Novell, Inc.
* Copyright (c) [2018-2023] SUSE LLC
* Copyright (c) [2018-2024] SUSE LLC
*
* All Rights Reserved.
*
Expand Down Expand Up @@ -388,6 +388,10 @@ namespace snapper
SDir::statvfs() const
{
struct statvfs fsbuf;

static_assert(sizeof(fsbuf.f_blocks) == 8);
static_assert(sizeof(fsbuf.f_bavail) == 8);

if (fstatvfs(dirfd, &fsbuf) != 0)
SN_THROW(IOErrorException(sformat("statvfs failed path:%s errno:%d (%s)", base_path.c_str(),
errno, stringerror(errno).c_str())));
Expand Down

0 comments on commit 6e3a73f

Please sign in to comment.