aboutsummaryrefslogtreecommitdiff
path: root/zenstore/gc.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-04-01 23:46:04 +0200
committerDan Engelbrecht <[email protected]>2022-04-01 23:46:04 +0200
commit6e9f6df8e4d51852327d05b254813b7b792f40a8 (patch)
tree743f941b39711bc5a4a3e85d6c11051460d99d81 /zenstore/gc.cpp
parentuse std::unsigned_integral for ToHexNumber and ParseHexNumber (diff)
downloadzen-6e9f6df8e4d51852327d05b254813b7b792f40a8.tar.xz
zen-6e9f6df8e4d51852327d05b254813b7b792f40a8.zip
error handling in BasicFile::SetFileSize
Diffstat (limited to 'zenstore/gc.cpp')
-rw-r--r--zenstore/gc.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp
index a86bae143..117fe3b49 100644
--- a/zenstore/gc.cpp
+++ b/zenstore/gc.cpp
@@ -123,18 +123,20 @@ namespace {
{
return zen::MakeErrorCodeFromLastError();
}
- if (posix_fallocate(Fd, 0, (off_t)Size) < 0)
+ std::error_code Ec = posix_fallocate(Fd, 0, (off_t)Size);
+ if (Ec)
{
- return zen::MakeErrorCodeFromLastError();
+ return Ec;
}
# else
if (ftruncate64(Fd, (off64_t)Size) < 0)
{
return zen::MakeErrorCodeFromLastError();
}
- if (posix_fallocate64(Fd, 0, (off64_t)Size) < 0)
+ std::error_code Ec = posix_fallocate64(Fd, 0, (off64_t)Size);
+ if (Ec)
{
- return zen::MakeErrorCodeFromLastError();
+ return Ec;
}
# endif
Keep = true;