X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fjournal.c;h=66c1b77534e98118ca7b300bb523d47b1d4b3493;hb=173d1687aea88e0e5e1b1d8615ed68ebefb15d08;hp=6b7332771c0f5e7727ffe631c04d11e1ab63a5ac;hpb=ddb7b52128d8f1f54d9632dc3a15c7869e0fbcce;p=pspp diff --git a/src/output/journal.c b/src/output/journal.c index 6b7332771c..66c1b77534 100644 --- a/src/output/journal.c +++ b/src/output/journal.c @@ -64,7 +64,8 @@ journal_close (void) if (journal != NULL && journal->file != NULL) { if (fwriteerror (journal->file)) - error (0, errno, _("error writing \"%s\""), journal_file_name); + error (0, errno, _("error writing output file `%s'"), + journal_file_name); journal->file = NULL; } } @@ -89,13 +90,19 @@ journal_output (struct journal_driver *j, const char *s) j->file = fopen (journal_file_name, "a"); if (j->file == NULL) { - error (0, errno, _("%s: open failed"), journal_file_name); + error (0, errno, _("error opening output file `%s'"), + journal_file_name); output_driver_destroy (&j->driver); return; } } 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