Flush the journal after every write.
[pspp] / src / output / journal.c
index 1a700898ac5e1d6707de700d4b59de1723b32c74..10da4d8485391651bb0a2b90b60afe2b67bba5f7 100644 (file)
@@ -98,6 +98,11 @@ journal_output (struct journal_driver *j, const char *s)
     }
 
   fprintf (j->file, "%s\n", s);
+
+  /* Flush the journal in case the syntax we're about to write
+     causes a crash.  Having the syntax already written to disk
+     makes postmortem analysis of the problem possible. */
+  fflush (j->file);
 }
 
 static void