This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  a2183f1165fe7de45e2d3f3a9fc70e2d8e9f3554 (commit)
       via  9eb8e4b22bf56dca81bf2f0507977d4c1fda535e (commit)
      from  2771c36f9476e0d7f948ad7f27665c675da77b44 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a2183f1165fe7de45e2d3f3a9fc70e2d8e9f3554
commit a2183f1165fe7de45e2d3f3a9fc70e2d8e9f3554
Merge: 2771c36 9eb8e4b
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Mar 14 08:27:16 2012 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Wed Mar 14 08:27:16 2012 -0400

    Merge topic 'write-cache-atomically' into next
    
    9eb8e4b Write CMakeCache.txt atomically (#13040)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9eb8e4b22bf56dca81bf2f0507977d4c1fda535e
commit 9eb8e4b22bf56dca81bf2f0507977d4c1fda535e
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Mar 14 08:16:05 2012 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed Mar 14 08:18:15 2012 -0400

    Write CMakeCache.txt atomically (#13040)
    
    The write code introduced by commit 0b0d1b1d (add CMakeCache.txt
    support, 2001-02-22) uses a temporary file but does not replace the
    original atomically.  Use cmGeneratedFileStream to do both
    copy-if-different and atomic replacement.

diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index ab0bb79..47a0e85 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -13,6 +13,7 @@
 #include "cmCacheManager.h"
 #include "cmSystemTools.h"
 #include "cmCacheManager.h"
+#include "cmGeneratedFileStream.h"
 #include "cmMakefile.h"
 #include "cmake.h"
 #include "cmVersion.h"
@@ -431,9 +432,8 @@ bool cmCacheManager::SaveCache(const char* path)
 {
   std::string cacheFile = path;
   cacheFile += "/CMakeCache.txt";
-  std::string tempFile = cacheFile;
-  tempFile += ".tmp";
-  std::ofstream fout(tempFile.c_str());
+  cmGeneratedFileStream fout(cacheFile.c_str());
+  fout.SetCopyIfDifferent(true);
   if(!fout)
     {
     cmSystemTools::Error("Unable to open cache file for save. ",
@@ -561,10 +561,7 @@ bool cmCacheManager::SaveCache(const char* path)
       }
     }
   fout << "\n";
-  fout.close();
-  cmSystemTools::CopyFileIfDifferent(tempFile.c_str(),
-                                     cacheFile.c_str());
-  cmSystemTools::RemoveFile(tempFile.c_str());
+  fout.Close();
   std::string checkCacheFile = path;
   checkCacheFile += cmake::GetCMakeFilesDirectory();
   cmSystemTools::MakeDirectory(checkCacheFile.c_str());

-----------------------------------------------------------------------

Summary of changes:
 Source/cmCacheManager.cxx |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits

Reply via email to