]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Drop LFs at the end of error from QEMU log
authorJiri Denemark <jdenemar@redhat.com>
Fri, 3 Jul 2015 17:35:06 +0000 (19:35 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 9 Jul 2015 19:58:44 +0000 (21:58 +0200)
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

index 54695c2eae0cd4d1092d6b01865de1e1dcf86b32..6b54f71baff8514b86f89782f7a6786375104d2e 100644 (file)
@@ -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);