Flush the journal after every write.
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 30 Jul 2010 17:49:03 +0000 (19:49 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 30 Jul 2010 17:49:03 +0000 (19:49 +0200)
Unexpected bugs in the parser, engine or in procedures can cause crashes
in the GUI.  If the journal is not flushed *before* running the syntax, then
no record of that syntax exists, and the bug can be hard to reproduce.
This change ensures that the syntax is written to the journal before it is
processed.

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