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

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



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

Attachment: signature.asc
Description: OpenPGP digital signature


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