don't remove correct file when failing to rename the incorrect one

This commit is contained in:
David Rose 2008-11-14 19:57:39 +00:00
parent 69985789f1
commit e640f676e0

View File

@ -274,7 +274,7 @@ store(BamCacheRecord *record) {
temp_file.close();
// Now move the file into place.
if (!temp_pathname.rename_to(cache_pathname)) {
if (!temp_pathname.rename_to(cache_pathname) && temp_pathname.exists()) {
cache_pathname.unlink();
if (!temp_pathname.rename_to(cache_pathname)) {
util_cat.error()