36e8a3
From 04326c02ca80666e66a5da8e6a46c2fc4476000c Mon Sep 17 00:00:00 2001
36e8a3
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
36e8a3
Date: Wed, 5 Dec 2018 21:34:24 +0100
36e8a3
Subject: [PATCH] coredump: fix message when we fail to save a journald
36e8a3
 coredump
36e8a3
36e8a3
If creation of the message failed, we'd write a bogus entry:
36e8a3
systemd-coredump[1400]: Cannot store coredump of 416 (systemd-journal): No space left on device
36e8a3
systemd-coredump[1400]: MESSAGE=Process 416 (systemd-journal) of user 0 dumped core.
36e8a3
systemd-coredump[1400]: Coredump diverted to
36e8a3
36e8a3
(cherry-picked from commit f0136e09221364f931c3a3b715da4e4d3ee9f2ac)
36e8a3
36e8a3
Related: #1664976
36e8a3
---
36e8a3
 src/coredump/coredump.c | 4 ++--
36e8a3
 1 file changed, 2 insertions(+), 2 deletions(-)
36e8a3
36e8a3
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
4bff0a
index ffa88f612d..2a130e8838 100644
36e8a3
--- a/src/coredump/coredump.c
36e8a3
+++ b/src/coredump/coredump.c
36e8a3
@@ -783,8 +783,8 @@ log:
36e8a3
         core_message = strjoin("MESSAGE=Process ", context[CONTEXT_PID],
36e8a3
                                " (", context[CONTEXT_COMM], ") of user ",
36e8a3
                                context[CONTEXT_UID], " dumped core.",
36e8a3
-                               journald_crash ? "\nCoredump diverted to " : NULL,
36e8a3
-                               journald_crash ? filename : NULL);
36e8a3
+                               journald_crash && filename ? "\nCoredump diverted to " : NULL,
36e8a3
+                               journald_crash && filename ? filename : NULL);
36e8a3
         if (!core_message)
36e8a3
                 return log_oom();
36e8a3