From: Jiri Denemark Date: Fri, 3 Jul 2015 17:35:06 +0000 (+0200) Subject: qemu: Drop LFs at the end of error from QEMU log X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=04d5fb2e0a92f78eca61de59971eba7fb36c6c1d;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git 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 --- diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 54695c2ea..6b54f71ba 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);