From 36658631e3f29b27d08b36fa6cf143d6902b7789 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Fri, 22 Nov 2024 10:58:20 +0100 Subject: fix inconsistencies in filecas due to failing to remove payload file during GC (#224) make sure we rewrite filecas entries if chunk size changes (due to compression changes) hardening of move/write files in filecas if we encounter a filecas entry with mismatching size (due to pre-existing bug) we validate the file and update the index if we find a bad filecas file on disk we now attempt to remove it --- src/zencore/filesystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/zencore/filesystem.cpp') diff --git a/src/zencore/filesystem.cpp b/src/zencore/filesystem.cpp index 93383a656..9ca5f1131 100644 --- a/src/zencore/filesystem.cpp +++ b/src/zencore/filesystem.cpp @@ -902,14 +902,14 @@ MoveToFile(std::filesystem::path Path, IoBuffer Data) { return false; } - int Ret = link(SourcePath.c_str(), Path.c_str()); + int Ret = rename(SourcePath.c_str(), Path.c_str()); if (Ret < 0) { int32_t err = errno; if (err == ENOENT) { zen::CreateDirectories(Path.parent_path()); - Ret = link(SourcePath.c_str(), Path.c_str()); + Ret = rename(SourcePath.c_str(), Path.c_str()); } } if (Ret < 0) -- cgit v1.2.3