[libvirt] [PATCH] qemu: Drop LFs at the end of error from QEMU log

Libvirt's error messages do not end with a LF. However, when reading the error from QEMU log, we would read the LF from the log and keep it in the message. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_monitor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 93fcc7f..896d9fd 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -407,6 +407,9 @@ qemuMonitorGetErrorFromLog(qemuMonitorPtr mon) if ((len = qemuProcessReadLog(mon->logfd, logbuf, 4096 - 1, 0, true)) <= 0) goto error; + while (len > 0 && logbuf[len - 1] == '\n') + logbuf[--len] = '\0'; + cleanup: errno = orig_errno; VIR_FORCE_CLOSE(mon->logfd); -- 2.4.5

On Wed, Jul 08, 2015 at 10:14:16 +0200, Jiri Denemark wrote:
Libvirt's error messages do not end with a LF. However, when reading the error from QEMU log, we would read the LF from the log and keep it in the message.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_monitor.c | 3 +++ 1 file changed, 3 insertions(+)
ACK, Peter

On Wed, Jul 08, 2015 at 10:22:06 +0200, Peter Krempa wrote:
On Wed, Jul 08, 2015 at 10:14:16 +0200, Jiri Denemark wrote:
Libvirt's error messages do not end with a LF. However, when reading the error from QEMU log, we would read the LF from the log and keep it in the message.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_monitor.c | 3 +++ 1 file changed, 3 insertions(+)
ACK,
Pushed, thanks. Jirka
participants (2)
-
Jiri Denemark
-
Peter Krempa