[libvirt] [PATCH] createRawFileOpHook: avoid dead stores

Eric Blake eblake at redhat.com
Wed Apr 7 19:42:20 UTC 2010


On 04/07/2010 12:42 PM, Jim Meyering wrote:
> +++ b/src/storage/storage_backend.c
> @@ -308,12 +308,11 @@ static int createRawFileOpHook(int fd, void *data) {
>                   * update every 9s is a fair-enough trade-off
>                   */
>                  unsigned long long bytes = 512 * 1024 * 1024;
> -                int r;
> 
>                  if (bytes > remain)
>                      bytes = remain;
> -                if ((r = safezero(fd, 0, hdata->vol->allocation - remain,
> -                                  bytes)) != 0) {
> +                if (safezero(fd, 0, hdata->vol->allocation - remain,
> +                             bytes) != 0) {
>                      ret = errno;
>                      virReportSystemError(errno, _("cannot fill file '%s'"),
>                                           hdata->vol->target.path);

ACK - the fact that it still compiles is proof of the dead store, so the
removal is safe.

-- 
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: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100407/6ce6d45d/attachment-0001.sig>


More information about the libvir-list mailing list