]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Fix error resetting on fallback paths
authorPeter Krempa <pkrempa@redhat.com>
Thu, 26 Jul 2012 09:24:30 +0000 (11:24 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 27 Jul 2012 08:34:58 +0000 (10:34 +0200)
On some fallback paths in virsh, error reported by the previously failed
API is cleared by virResetLastError() that doesn't free error stored by
virsh. This patch changes this to clear it using vshResetLibvirtError().

tools/virsh-domain-monitor.c
tools/virsh-snapshot.c

index 65a9808d16a13c768e038bcb45f2da4c938803e6..151a8d00ace5af1d668c299381e5a1bd79bd1ea4 100644 (file)
@@ -66,7 +66,7 @@ vshGetDomainDescription(vshControl *ctl, virDomainPtr dom, bool title,
 
         if (err && err->code == VIR_ERR_NO_DOMAIN_METADATA) {
             desc = vshStrdup(ctl, "");
-            virResetLastError();
+            vshResetLibvirtError();
             return desc;
         }
 
@@ -1362,7 +1362,7 @@ vshDomainListCollect(vshControl *ctl, unsigned int flags)
 
 fallback:
     /* fall back to old method (0.9.12 and older) */
-    virResetLastError();
+    vshResetLibvirtError();
 
     /* list active domains, if necessary */
     if (!MATCH(VIR_CONNECT_LIST_FILTERS_ACTIVE) ||
index 92f0d6ce380ba59c0f086dc2460e909b8d098db0..d6de3da57c6d92de30e3ef7e8687f6227af879a5 100644 (file)
@@ -704,7 +704,7 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd)
     if (current < 0) {
         virDomainSnapshotPtr other = virDomainSnapshotCurrent(dom, 0);
 
-        virResetLastError();
+        vshResetLibvirtError();
         current = 0;
         if (other) {
             if (STREQ(name, virDomainSnapshotGetName(other)))
@@ -759,7 +759,7 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd)
     if (metadata < 0) {
         metadata = virDomainSnapshotNum(dom,
                                         VIR_DOMAIN_SNAPSHOT_LIST_METADATA);
-        virResetLastError();
+        vshResetLibvirtError();
     }
     if (metadata >= 0)
         vshPrint(ctl, "%-15s %s\n", _("Metadata:"),