mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-22 14:09:22 +00:00
Fix discard of expected errors
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
This commit is contained in:
parent
9f5bbe3b92
commit
449b4c87b5
@ -2122,6 +2122,9 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (last_error->code != VIR_ERR_NO_SUPPORT) {
|
if (last_error->code != VIR_ERR_NO_SUPPORT) {
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
virFreeError(last_error);
|
||||||
|
last_error = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Only print something if a security model is active */
|
/* 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)
|
if (!tmp || virStrToLong_i(tmp + 1, &tmp, 10, &count) < 0)
|
||||||
count = -1;
|
count = -1;
|
||||||
}
|
}
|
||||||
|
virFreeError(last_error);
|
||||||
|
last_error = NULL;
|
||||||
VIR_FREE(xml);
|
VIR_FREE(xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user