浏览代码

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

David Rose 17 年之前
父节点
当前提交
e640f676e0
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      panda/src/putil/bamCache.cxx

+ 1 - 1
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()