From: Daniel P. Berrange Date: Thu, 21 Apr 2011 16:13:56 +0000 (+0100) Subject: Ensure we always read a full buffer in tunnelled migration X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=74f332468dad3c4926a68fc41c93a4efb10b7233;p=libvirt.git Ensure we always read a full buffer in tunnelled migration 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 --- diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 12486f5145..b132d860cd 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -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"));