]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
phypUUIDTable_Push: do not corrupt output stream upon partial write
authorJim Meyering <meyering@redhat.com>
Mon, 1 Mar 2010 20:26:59 +0000 (21:26 +0100)
committerJim Meyering <meyering@redhat.com>
Tue, 2 Mar 2010 07:58:07 +0000 (08:58 +0100)
* src/phyp/phyp_driver.c (phypUUIDTable_Push): Move incr/decr
of ptr/nread into the loop where those variables are used.
Also, remove "exit" label and just-preceding "goto".

src/phyp/phyp_driver.c

index 1e8ed3020cc9b12c27540210a75ae0e6190c4386..3fc5a0c27e506830b594a39a728221cba2c08a04 100644 (file)
@@ -2002,14 +2002,11 @@ phypUUIDTable_Push(virConnectPtr conn)
                 /* rc indicates how many bytes were written this time */
                 sent += rc;
             }
+            ptr += sent;
+            nread -= sent;
         } while (rc > 0 && sent < nread);
-        ptr += sent;
-        nread -= sent;
     } while (1);
 
-    goto exit;
-
-  exit:
     if (channel) {
         libssh2_channel_send_eof(channel);
         libssh2_channel_wait_eof(channel);