]> xenbits.xensource.com Git - libvirt.git/commitdiff
Ensure we always read a full buffer in tunnelled migration
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 21 Apr 2011 16:13:56 +0000 (17:13 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 16 May 2011 14:18:22 +0000 (15:18 +0100)
The 'nbytes' variable was not re-initialized to the
buffer size on each iteration of the tunnelled migration
loop. While saferead() will ensure a full read, except
on EOF, it is clearer to use the real buffer size

* src/qemu/qemu_migration.c: Always read full buffer of data

src/qemu/qemu_migration.c

index 12486f5145103a286219780c0baff4bf61de0719..b132d860cd1748a00c2f7cb3111c5c9ac4bff504 100644 (file)
@@ -1300,7 +1300,7 @@ static int doTunnelSendAll(virStreamPtr st,
     }
 
     for (;;) {
-        nbytes = saferead(sock, buffer, nbytes);
+        nbytes = saferead(sock, buffer, TUNNEL_SEND_BUF_SIZE);
         if (nbytes < 0) {
             virReportSystemError(errno, "%s",
                                  _("tunnelled migration failed to read from qemu"));