journal-file: avoid calling ftruncate with invalid fd

This can happen if journal_file_close is called from the failure
handling code of journal_file_open before f->fd was established.
This commit is contained in:
David Tardon
2018-10-12 14:51:35 +02:00
parent 0b777d20e9
commit c52368509f
+3
View File
@@ -1846,6 +1846,9 @@ static int journal_file_append_entry_internal(
void journal_file_post_change(JournalFile *f) {
assert(f);
if (f->fd < 0)
return;
/* inotify() does not receive IN_MODIFY events from file
* accesses done via mmap(). After each access we hence
* trigger IN_MODIFY by truncating the journal file to its