Re: [libvirt] [PATCH] phypUUIDTable_Push: do not corrupt output stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]