dcavalca / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
84b277
From b5915d4a5870668442d3ef08a3b1f6b0028ea97f Mon Sep 17 00:00:00 2001
84b277
From: Uoti Urpala <uoti.urpala@pp1.inet.fi>
84b277
Date: Thu, 20 Feb 2014 03:00:09 +0200
84b277
Subject: [PATCH] logs-show: fix corrupt output with empty messages
84b277
84b277
If a message had zero length, journalctl would print no newline, and
84b277
two output lines would be concatenated. Fix. The problem was
84b277
introduced in commit 31f7bf199452 ("logs-show: print multiline
84b277
messages"). Affected short and verbose output modes.
84b277
84b277
Before fix:
84b277
84b277
Feb 09 21:16:17 glyph dhclient[1323]: Feb 09 21:16:17 glyph NetworkManager[788]: <info> (enp4s2): DHCPv4 state changed nbi -> preinit
84b277
84b277
after:
84b277
84b277
Feb 09 21:16:17 glyph dhclient[1323]:
84b277
Feb 09 21:16:17 glyph NetworkManager[788]: <info> (enp4s2): DHCPv4 state changed nbi -> preinit
84b277
84b277
(cherry-picked from 47d80904a1f72d559962cc5ad32fffd46672a34a)
84b277
84b277
Resolves: #1147524
84b277
---
84b277
 src/shared/logs-show.c | 5 +++++
84b277
 1 file changed, 5 insertions(+)
84b277
84b277
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
84b277
index 7bb19b4..91eefb3 100644
84b277
--- a/src/shared/logs-show.c
84b277
+++ b/src/shared/logs-show.c
84b277
@@ -121,6 +121,11 @@ static bool print_multiline(FILE *f, unsigned prefix, unsigned n_columns, Output
84b277
                 }
84b277
         }
84b277
 
84b277
+        /* A special case: make sure that we print a newline when
84b277
+           the message is empty. */
84b277
+        if (message_len == 0)
84b277
+                fputs("\n", f);
84b277
+
84b277
         for (pos = message;
84b277
              pos < message + message_len;
84b277
              pos = end + 1, line++) {