aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zenstore/filecas.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/zenstore/filecas.cpp b/zenstore/filecas.cpp
index ee641b80a..e45650f27 100644
--- a/zenstore/filecas.cpp
+++ b/zenstore/filecas.cpp
@@ -183,8 +183,15 @@ FileCasStrategy::InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash)
return CasStore::InsertResult{.New = true};
}
+ const DWORD LastError = GetLastError();
+
+ if ((LastError == ERROR_FILE_EXISTS) || (LastError == ERROR_ALREADY_EXISTS))
+ {
+ return CasStore::InsertResult{.New = false};
+ }
+
ZEN_WARN("rename of CAS payload file failed ('{}'), falling back to regular write for insert of {}",
- GetLastErrorAsString(),
+ GetSystemErrorAsString(LastError),
ChunkHash);
DeletePayloadFileOnClose();