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-10 13:56:54 +02:00
parent 0b777d20e9
commit c52368509f
1 changed files with 3 additions and 0 deletions

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