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