]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coredump: fix message when we fail to save a journald coredump
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 5 Dec 2018 20:34:24 +0000 (21:34 +0100)
committerLukáš Nykrýn <lnykryn@redhat.com>
Thu, 7 Feb 2019 11:57:43 +0000 (12:57 +0100)
If creation of the message failed, we'd write a bogus entry:
systemd-coredump[1400]: Cannot store coredump of 416 (systemd-journal): No space left on device
systemd-coredump[1400]: MESSAGE=Process 416 (systemd-journal) of user 0 dumped core.
systemd-coredump[1400]: Coredump diverted to

(cherry-picked from commit f0136e09221364f931c3a3b715da4e4d3ee9f2ac)

Related: #1664976

src/coredump/coredump.c

index ffa88f612d3eafe40227981cc8f069c30894b15b..2a130e88387f213b5a2c4a2defbddd72a2cdaa2d 100644 (file)
@@ -783,8 +783,8 @@ log:
         core_message = strjoin("MESSAGE=Process ", context[CONTEXT_PID],
                                " (", context[CONTEXT_COMM], ") of user ",
                                context[CONTEXT_UID], " dumped core.",
-                               journald_crash ? "\nCoredump diverted to " : NULL,
-                               journald_crash ? filename : NULL);
+                               journald_crash && filename ? "\nCoredump diverted to " : NULL,
+                               journald_crash && filename ? filename : NULL);
         if (!core_message)
                 return log_oom();