diff options
| author | Dan Engelbrecht <[email protected]> | 2022-04-02 00:08:26 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-04-02 00:08:26 +0200 |
| commit | c2603f19ae2ac57b68eb8d6187cda668c70f2b2b (patch) | |
| tree | dfadb017062226a0df0e5e24f4b8c2e92be547dc /zenstore/gc.cpp | |
| parent | rename EMode to Mode (diff) | |
| download | zen-c2603f19ae2ac57b68eb8d6187cda668c70f2b2b.tar.xz zen-c2603f19ae2ac57b68eb8d6187cda668c70f2b2b.zip | |
proper error handling when setting file size
Diffstat (limited to 'zenstore/gc.cpp')
| -rw-r--r-- | zenstore/gc.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp index 117fe3b49..311f7ced4 100644 --- a/zenstore/gc.cpp +++ b/zenstore/gc.cpp @@ -73,7 +73,7 @@ namespace { if (FileHandle == INVALID_HANDLE_VALUE) { - return zen::MakeErrorCodeFromLastError(); + return MakeErrorCodeFromLastError(); } bool Keep = true; auto _ = MakeGuard([FileHandle, &Keep, Path]() { @@ -88,12 +88,12 @@ namespace { BOOL OK = ::SetFilePointerEx(FileHandle, liFileSize, 0, FILE_BEGIN); if (!OK) { - return zen::MakeErrorCodeFromLastError(); + return MakeErrorCodeFromLastError(); } OK = ::SetEndOfFile(FileHandle); if (!OK) { - return zen::MakeErrorCodeFromLastError(); + return MakeErrorCodeFromLastError(); } Keep = true; #else @@ -101,7 +101,7 @@ namespace { int Fd = open(Path.c_str(), OpenFlags, 0666); if (Fd < 0) { - return zen::MakeErrorCodeFromLastError(); + return MakeErrorCodeFromLastError(); } bool Keep = true; @@ -115,13 +115,13 @@ namespace { if (fchmod(Fd, 0666) < 0) { - return zen::MakeErrorCodeFromLastError(); + return MakeErrorCodeFromLastError(); } # if ZEN_PLATFORM_MAC if (ftruncate(Fd, (off_t)Size) < 0) { - return zen::MakeErrorCodeFromLastError(); + return MakeErrorCodeFromLastError(); } std::error_code Ec = posix_fallocate(Fd, 0, (off_t)Size); if (Ec) @@ -131,7 +131,7 @@ namespace { # else if (ftruncate64(Fd, (off64_t)Size) < 0) { - return zen::MakeErrorCodeFromLastError(); + return MakeErrorCodeFromLastError(); } std::error_code Ec = posix_fallocate64(Fd, 0, (off64_t)Size); if (Ec) |