[cig-commits] [commit] master: Close a file before we attempt to move it. (7804907)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Thu Sep 4 12:09:51 PDT 2014
Repository : https://github.com/geodynamics/aspect
On branch : master
Link : https://github.com/geodynamics/aspect/compare/7fdc3c59c0e6bd28a26d46a1a11ed5e461266e84...112a6cff8eadef8902a3687aab82cf20d93106ce
>---------------------------------------------------------------
commit 780490789bfde0ffbe58e0dfc504ffa205f748d7
Author: Wolfgang Bangerth <bangerth at math.tamu.edu>
Date: Wed Sep 3 19:52:38 2014 -0500
Close a file before we attempt to move it.
>---------------------------------------------------------------
780490789bfde0ffbe58e0dfc504ffa205f748d7
doc/modules/changes.h | 8 ++++++++
source/postprocess/visualization.cc | 1 +
2 files changed, 9 insertions(+)
diff --git a/doc/modules/changes.h b/doc/modules/changes.h
index ae32f63..402ad92 100644
--- a/doc/modules/changes.h
+++ b/doc/modules/changes.h
@@ -6,6 +6,14 @@
*
*
* <ol>
+ * <li> Fixed: There was a race condition in writing output files: we
+ * write to them in a temporary location and then move them to their
+ * final location. We used to do the second step before actually closing
+ * the file we just wrote to. Under some circumstances, this could lead
+ * to incomplete or empty output files. This is now fixed.
+ * <br>
+ * (Wolfgang Bangerth, 2014/09/03)
+ *
* <li> Fixed: Running in release mode and with user-defined libraries
* loaded that were compiled against the debug version of deal.II, or the
* other way around, likely produces effects that are undesirable. ASPECT
diff --git a/source/postprocess/visualization.cc b/source/postprocess/visualization.cc
index 6323b87..b4adf67 100644
--- a/source/postprocess/visualization.cc
+++ b/source/postprocess/visualization.cc
@@ -547,6 +547,7 @@ namespace aspect
// now write and then move the tmp file to its final destination
// if necessary
out << *file_contents;
+ out.close ();
if (tmp_filename != *filename)
{
More information about the CIG-COMMITS
mailing list