[libvirt] [PATCH 13/16] Ensure we always read a full buffer in tunnelled migration

Daniel P. Berrange berrange at redhat.com
Thu Apr 21 16:32:52 UTC 2011


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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 4fb4c83..dd19e55 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1328,7 +1328,7 @@ static int doTunnelSendAll(struct qemud_driver *driver,
     while (priv->jobInfo.type == VIR_DOMAIN_JOB_UNBOUNDED) {
         virDomainObjUnlock(vm);
         qemuDriverUnlock(driver);
-        nbytes = saferead(sock, buffer, nbytes);
+        nbytes = saferead(sock, buffer, TUNNEL_SEND_BUF_SIZE);
         qemuDriverLock(driver);
         virDomainObjLock(vm);
 
-- 
1.7.4.4




More information about the libvir-list mailing list