|
|
ddca0b |
From dc4c3a5aa35a5e88adcf210471d9460262c8c0d9 Mon Sep 17 00:00:00 2001
|
|
|
ddca0b |
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
|
|
ddca0b |
Date: Tue, 28 May 2019 12:40:17 +0900
|
|
|
ddca0b |
Subject: [PATCH] journal: do not trigger assertion when journal_file_close()
|
|
|
ddca0b |
get NULL
|
|
|
ddca0b |
|
|
|
ddca0b |
We generally expect destructors to not complain if a NULL argument is passed.
|
|
|
ddca0b |
|
|
|
ddca0b |
Closes #12400.
|
|
|
ddca0b |
|
|
|
ddca0b |
(cherry picked from commit c377a6f3ad3d9bed4ce7e873e8e9ec6b1650c57d)
|
|
|
ddca0b |
Resolves: #1788085
|
|
|
ddca0b |
---
|
|
|
ddca0b |
src/journal/journal-file.c | 3 ++-
|
|
|
ddca0b |
src/journal/journald-server.c | 7 ++-----
|
|
|
ddca0b |
2 files changed, 4 insertions(+), 6 deletions(-)
|
|
|
ddca0b |
|
|
|
ddca0b |
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
|
|
|
ddca0b |
index efc3ee052b..8249b11b23 100644
|
|
|
ddca0b |
--- a/src/journal/journal-file.c
|
|
|
ddca0b |
+++ b/src/journal/journal-file.c
|
|
|
ddca0b |
@@ -335,7 +335,8 @@ bool journal_file_is_offlining(JournalFile *f) {
|
|
|
ddca0b |
}
|
|
|
ddca0b |
|
|
|
ddca0b |
JournalFile* journal_file_close(JournalFile *f) {
|
|
|
ddca0b |
- assert(f);
|
|
|
ddca0b |
+ if (!f)
|
|
|
ddca0b |
+ return NULL;
|
|
|
ddca0b |
|
|
|
ddca0b |
#if HAVE_GCRYPT
|
|
|
ddca0b |
/* Write the final tag */
|
|
|
ddca0b |
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
|
|
|
ddca0b |
index 6aecb67d6c..6250eab831 100644
|
|
|
ddca0b |
--- a/src/journal/journald-server.c
|
|
|
ddca0b |
+++ b/src/journal/journald-server.c
|
|
|
ddca0b |
@@ -1906,11 +1906,8 @@ void server_done(Server *s) {
|
|
|
ddca0b |
|
|
|
ddca0b |
client_context_flush_all(s);
|
|
|
ddca0b |
|
|
|
ddca0b |
- if (s->system_journal)
|
|
|
ddca0b |
- (void) journal_file_close(s->system_journal);
|
|
|
ddca0b |
-
|
|
|
ddca0b |
- if (s->runtime_journal)
|
|
|
ddca0b |
- (void) journal_file_close(s->runtime_journal);
|
|
|
ddca0b |
+ (void) journal_file_close(s->system_journal);
|
|
|
ddca0b |
+ (void) journal_file_close(s->runtime_journal);
|
|
|
ddca0b |
|
|
|
ddca0b |
ordered_hashmap_free_with_destructor(s->user_journals, journal_file_close);
|
|
|
ddca0b |
|