[PATCH] Fix qemuProcessReadLog with non-zero offset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This restores the error message when QMP probing is not used.

https://bugzilla.redhat.com/show_bug.cgi?id=991334
---
 src/qemu/qemu_process.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 0dccac3..31de759 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1435,18 +1435,17 @@ qemuProcessReadLog(int fd, char *buf, int buflen, int off)
     ssize_t bytes;
     char *eol;
 
-    buf[0] = '\0';
-
     while (off < buflen - 1) {
         bytes = saferead(fd, buf + off, buflen - off - 1);
         if (bytes < 0)
             return -1;
-        else if (bytes == 0)
-            break;
 
         off += bytes;
         buf[off] = '\0';
 
+        if (bytes == 0)
+            break;
+
         /* Filter out debug messages from intermediate libvirt process */
         while ((eol = strchr(filter_next, '\n'))) {
             *eol = '\0';
-- 
1.8.1.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]