7a3408
From 4b79d32a523e7ce5dc0e1e0123e74a2ea1b6ffc5 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <4b79d32a523e7ce5dc0e1e0123e74a2ea1b6ffc5@dist-git>
7a3408
From: Jiri Denemark <jdenemar@redhat.com>
7a3408
Date: Fri, 3 Jul 2015 19:35:06 +0200
7a3408
Subject: [PATCH] qemu: Drop LFs at the end of error from QEMU log
7a3408
7a3408
Libvirt's error messages do not end with a LF. However, when reading the
7a3408
error from QEMU log, we would read the LF from the log and keep it in
7a3408
the message.
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
(cherry picked from commit 04d5fb2e0a92f78eca61de59971eba7fb36c6c1d)
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1090093
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_monitor.c | 3 +++
7a3408
 1 file changed, 3 insertions(+)
7a3408
7a3408
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
7a3408
index d7d211e..dabe8e2 100644
7a3408
--- a/src/qemu/qemu_monitor.c
7a3408
+++ b/src/qemu/qemu_monitor.c
7a3408
@@ -407,6 +407,9 @@ qemuMonitorGetErrorFromLog(qemuMonitorPtr mon)
7a3408
     if ((len = qemuProcessReadLog(mon->logfd, logbuf, 4096 - 1, 0, true)) <= 0)
7a3408
         goto error;
7a3408
 
7a3408
+    while (len > 0 && logbuf[len - 1] == '\n')
7a3408
+        logbuf[--len] = '\0';
7a3408
+
7a3408
  cleanup:
7a3408
     errno = orig_errno;
7a3408
     VIR_FORCE_CLOSE(mon->logfd);
7a3408
-- 
7a3408
2.4.5
7a3408