Browse Source

HPCC-20184 Ensure that old cache entries are overwritten

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 6 years ago
parent
commit
84432108e2
2 changed files with 2 additions and 2 deletions
  1. 1 1
      ecl/hql/hqlexpr.cpp
  2. 1 1
      system/jlib/jfile.cpp

+ 1 - 1
ecl/hql/hqlexpr.cpp

@@ -1127,7 +1127,7 @@ bool HqlParseContext::createCache(IHqlExpression * simplifiedDefinition, bool is
         writeStringToStream(*stream, "</Cache>\n");
         writeStringToStream(*stream, "</Cache>\n");
         stream->flush();
         stream->flush();
     }
     }
-    cacheFile->rename(filename);
+    cacheFile->move(filename);
     return true;
     return true;
 }
 }
 
 

+ 1 - 1
system/jlib/jfile.cpp

@@ -779,7 +779,7 @@ void CFile::move(const char *newname)
 #ifdef _WIN32
 #ifdef _WIN32
     unsigned retry = 0;
     unsigned retry = 0;
     for (;;) {
     for (;;) {
-        if (MoveFileEx(filename.get(),newname,0)) 
+        if (MoveFileEx(filename.get(),newname, MOVEFILE_REPLACE_EXISTING))
             return;
             return;
         DWORD err = GetLastError();
         DWORD err = GetLastError();
         if ((retry++==10)||  // some or all of the following can occur when the domain controller gets busy
         if ((retry++==10)||  // some or all of the following can occur when the domain controller gets busy