From e640f676e0fb81644c9dd122e5191c2a1beac261 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 14 Nov 2008 19:57:39 +0000 Subject: [PATCH] don't remove correct file when failing to rename the incorrect one --- panda/src/putil/bamCache.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/putil/bamCache.cxx b/panda/src/putil/bamCache.cxx index 4854f44e03..fec5a1a02b 100644 --- a/panda/src/putil/bamCache.cxx +++ b/panda/src/putil/bamCache.cxx @@ -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()