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