]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix discard of expected errors
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 22 Feb 2011 17:31:35 +0000 (17:31 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 23 Feb 2011 11:11:55 +0000 (11:11 +0000)
In a couple of commands virsh catches & ignores errors, but fails
to reset last_error. Thus the error is ignored, but still reported
to the user.

* tools/virsh.c: Reset last_error if ignoring an error

tools/virsh.c

index 2837e0f6aad5e66fccfd1b04d9919be765a02492..62fca1722ba5bdb304adf2e3be801471cf163415 100644 (file)
@@ -2122,6 +2122,9 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
         if (last_error->code != VIR_ERR_NO_SUPPORT) {
             virDomainFree(dom);
             return FALSE;
+        } else {
+            virFreeError(last_error);
+            last_error = NULL;
         }
     } else {
         /* Only print something if a security model is active */
@@ -2498,6 +2501,8 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd)
                 if (!tmp || virStrToLong_i(tmp + 1, &tmp, 10, &count) < 0)
                     count = -1;
             }
+            virFreeError(last_error);
+            last_error = NULL;
             VIR_FREE(xml);
         }