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:
parent
0b777d20e9
commit
c52368509f
|
@ -1846,6 +1846,9 @@ static int journal_file_append_entry_internal(
|
||||||
void journal_file_post_change(JournalFile *f) {
|
void journal_file_post_change(JournalFile *f) {
|
||||||
assert(f);
|
assert(f);
|
||||||
|
|
||||||
|
if (f->fd < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
/* inotify() does not receive IN_MODIFY events from file
|
/* inotify() does not receive IN_MODIFY events from file
|
||||||
* accesses done via mmap(). After each access we hence
|
* accesses done via mmap(). After each access we hence
|
||||||
* trigger IN_MODIFY by truncating the journal file to its
|
* trigger IN_MODIFY by truncating the journal file to its
|
||||||
|
|
Loading…
Reference in a new issue