Re: [PATCH] (qemuTeardownDiskCgroup): avoid dead code

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

 



On 05/17/2010 11:40 PM, Jim Meyering wrote:
> Eric Blake wrote:
>> On 05/17/2010 02:52 PM, Jim Meyering wrote:
>>> It's a good thing the latter while loop condition
>>> could never be true -- otherwise it'd be an infloop.
>>>
>>>      char *path = disk->src;
>>>      int ret = -1;
>>>
>>> -    while (path != NULL) {
>>> +    do {
>>>          virStorageFileMetadata meta;
>>>          int rc;
>>>
>>>          VIR_DEBUG("Process path %s for disk", path);
>> ...
>>>          path = meta.backingStore;
>>>      } while (path != NULL);
>>
>> Are we sure disk->src is guaranteed to be non-NULL on entry, or would
>> have been better to rewrite this as while{}/*nothing*/ instead of do{}while?
> 
> You're right.
> disk->src may be NULL, as attested by surrounding code that tests for it
> via NULLSTR upon failure of these functions.
> Thanks!
> 
> Here's a better patch:

ACK to v2.

-- 
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]