Re: [PATCHv2 12/13] list: new helper function to collect snapshots

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

 



On 06/14/2012 10:18 PM, Eric Blake wrote:
> Wraps the conversion from 'char *name' to virDomainSnapshotPtr in
> a reusable manner.
> 
> * src/conf/virdomainlist.h (virDomainListSnapshots): New declaration.
> * src/conf/virdomainlist.c (virDomainListSnapshots): Implement it.
> * src/libvirt_private.syms (virdomainlist.h): Export it.
> ---
> 
> v2: no real change
> 

Turns out I needed to squash this in after all, to avoid calling
virGetDomainSnapshot with a NULL argument.

> +
> +    virDomainSnapshotObjListGetNames(snapshots, from, names, count, flags);
> +    for (i = 0; i < count; i++)
> +        if ((list[i] = virGetDomainSnapshot(dom, names[i])) == NULL)
> +            goto cleanup;

diff --git i/src/conf/virdomainlist.c w/src/conf/virdomainlist.c
index 663591a..6ac2af1 100644
--- i/src/conf/virdomainlist.c
+++ w/src/conf/virdomainlist.c
@@ -202,7 +202,9 @@ virDomainListSnapshots(virDomainSnapshotObjListPtr
snapshots,
         goto cleanup;
     }

-    virDomainSnapshotObjListGetNames(snapshots, from, names, count, flags);
+    if (virDomainSnapshotObjListGetNames(snapshots, from, names, count,
+                                         flags) < 0)
+        goto cleanup;
     for (i = 0; i < count; i++)
         if ((list[i] = virGetDomainSnapshot(dom, names[i])) == NULL)
             goto cleanup;

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
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]