diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-05-28 12:40:17 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-05-28 18:07:18 +0900 |
commit | c377a6f3ad3d9bed4ce7e873e8e9ec6b1650c57d (patch) | |
tree | 26e793d251aec2881307f47d4b16ac5bc90ca9ca /src/journal | |
parent | 3fb106901965d36fbc598ceec4f98b7ba1f42eeb (diff) | |
download | systemd-c377a6f3ad3d9bed4ce7e873e8e9ec6b1650c57d.tar.gz systemd-c377a6f3ad3d9bed4ce7e873e8e9ec6b1650c57d.tar.bz2 systemd-c377a6f3ad3d9bed4ce7e873e8e9ec6b1650c57d.zip |
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.
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journal-file.c | 3 | ||||
-rw-r--r-- | src/journal/journald-server.c | 7 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index c38c3e7c14..c2dcf76deb 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -340,7 +340,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 414571191f..b2638c09b3 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -2232,11 +2232,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); |