Skip to content
Snippets Groups Projects
Commit 42f62d56 authored by Michael Biebl's avatar Michael Biebl
Browse files

journal: do not trigger assertion when journal_file_close() get NULL

Closes: #975561
parent 9d1363e9
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ index 2791678..3a9e20a 100644
<literal>systemd.journald.forward_to_syslog</literal>,
<literal>systemd.journald.forward_to_kmsg</literal>,
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 2a960eb..7fe0f82 100644
index ba0b35d..cd45212 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -1835,6 +1835,7 @@ int server_init(Server *s) {
......
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 28 May 2019 12:40:17 +0900
Subject: 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)
---
src/journal/journal-file.c | 3 ++-
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 56827f9..04cf1ef 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 2a960eb..ba0b35d 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);
......@@ -55,6 +55,7 @@ Fix-typo-in-function-name.patch
basic-cap-list-parse-print-numerical-capabilities.patch
missing-Add-new-Linux-capabilities.patch
networkd-do-not-generate-MAC-for-bridge-device.patch
journal-do-not-trigger-assertion-when-journal_file_close-.patch
debian/Use-Debian-specific-config-files.patch
debian/Bring-tmpfiles.d-tmp.conf-in-line-with-Debian-defaul.patch
debian/Make-run-lock-tmpfs-an-API-fs.patch
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment