[libvirt] [PATCH] phypUUIDTable_Push: do not corrupt output stream
Eric Blake
eblake at redhat.com
Mon Mar 1 20:49:23 UTC 2010
According to Jim Meyering on 3/1/2010 1:35 PM:
> This started with clang's report of the two dead stores.
> With the increment and decrement by "sent" being performed outside
> of the intended loop, the two assignments had no net effect.
>
> do {
> /* write the same data over and over, until error or completion */
> rc = libssh2_channel_write(channel, ptr, nread);
> if (LIBSSH2_ERROR_EAGAIN == rc) { /* must loop around */
> continue;
> } else if (rc > 0) {
> /* rc indicates how many bytes were written this time */
> sent += rc;
> }
> + ptr += sent;
> + nread -= sent;
> } while (rc > 0 && sent < nread);
> - ptr += sent;
> - nread -= sent;
ACK.
> } while (1);
>
> - goto exit;
> -
> - exit:
Definitely worth the cleanup.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 320 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100301/82d478a0/attachment-0001.sig>
More information about the libvir-list
mailing list