]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix qemuProcessReadLog with non-zero offset
authorJán Tomko <jtomko@redhat.com>
Thu, 15 Aug 2013 13:05:29 +0000 (15:05 +0200)
committerJán Tomko <jtomko@redhat.com>
Fri, 16 Aug 2013 18:36:11 +0000 (20:36 +0200)
This restores the error message when QMP probing is not used.

https://bugzilla.redhat.com/show_bug.cgi?id=991334
(cherry picked from commit 9ceaaa08e9b2281a5b58ac2f896761b2703d8791)

src/qemu/qemu_process.c

index d631a6f7189a6fdc45ce69744f4143624df89cfd..fad2fe837da4ef39d5ff34528769fe85bfb46fbe 100644 (file)
@@ -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';