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;
}
}
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