diff options
author | David Tardon <dtardon@redhat.com> | 2018-10-10 13:56:54 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2018-10-12 14:51:35 +0200 |
commit | c52368509f48e556be5a4c7a171361b656a25e02 (patch) | |
tree | 6cfba0de51220c9003fb164f97090570f675c461 | |
parent | 0b777d20e9a3868b12372ffce8040d1be063cec7 (diff) | |
download | systemd-c52368509f48e556be5a4c7a171361b656a25e02.tar.gz systemd-c52368509f48e556be5a4c7a171361b656a25e02.tar.bz2 systemd-c52368509f48e556be5a4c7a171361b656a25e02.zip |
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.
-rw-r--r-- | src/journal/journal-file.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index e9dddbc0d7..9c92d67516 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -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 |