From: Yu Watanabe Date: Tue, 28 May 2019 03:40:17 +0000 (+0900) Subject: journal: do not trigger assertion when journal_file_close() get NULL X-Git-Tag: archive/raspbian/241-7_deb10u6+rpi1^2~19 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=79f519ffda9430c9939479d482ee61809ac515bd;p=systemd.git journal: do not trigger assertion when journal_file_close() get NULL We generally expect destructors to not complain if a NULL argument is passed. Closes #12400. (cherry picked from commit c377a6f3ad3d9bed4ce7e873e8e9ec6b1650c57d) Gbp-Pq: Name journal-do-not-trigger-assertion-when-journal_file_close-.patch --- diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index 56827f9f..04cf1efe 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -335,7 +335,8 @@ bool journal_file_is_offlining(JournalFile *f) { } JournalFile* journal_file_close(JournalFile *f) { - assert(f); + if (!f) + return NULL; #if HAVE_GCRYPT /* Write the final tag */ diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 2a960ebb..ba0b35d0 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -2037,11 +2037,8 @@ void server_done(Server *s) { client_context_flush_all(s); - if (s->system_journal) - (void) journal_file_close(s->system_journal); - - if (s->runtime_journal) - (void) journal_file_close(s->runtime_journal); + (void) journal_file_close(s->system_journal); + (void) journal_file_close(s->runtime_journal); ordered_hashmap_free_with_destructor(s->user_journals, journal_file_close);