From: John Darrington Date: Fri, 30 Jul 2010 17:49:03 +0000 (+0200) Subject: Flush the journal after every write. X-Git-Tag: sav-api~134 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f14ea735832776eb7a28fe9e210bb270d401060e;p=pspp Flush the journal after every write. 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. --- diff --git a/src/output/journal.c b/src/output/journal.c index 1a700898ac..10da4d8485 100644 --- a/src/output/journal.c +++ b/src/output/journal.c @@ -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