From 2751ab289bad78ff3da59d164859598ef52d7802 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 26 Jul 2012 11:24:30 +0200 Subject: [PATCH] virsh: Fix error resetting on fallback paths 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 | 4 ++-- tools/virsh-snapshot.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 65a9808d16..151a8d00ac 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -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) || diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 92f0d6ce38..d6de3da57c 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -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:"), -- 2.39.5