Cole Robinson wrote:
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/qemu/qemu_driver.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fc6b9fa..38be88f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2616,12 +2616,17 @@ static void qemudShutdownVMDaemon(virConnectPtr conn,
int ret;
int retries = 0;
qemuDomainObjPrivatePtr priv = vm->privateData;
+ virErrorPtr origerr = NULL;
That assignment is technically what they call a dead store,
since the very next use is to overwrite that just-stored value.
So, to avoid warnings from the likes of the clang static checker,
do this instead:
virErrorPtr origerr;
if (!virDomainObjIsActive(vm))
return;
VIR_DEBUG("Shutting down VM '%s'", vm->def->name);
+ /* This method is routinely used in clean up paths. Disable error
+ * reporting so we don't squash a legit error. */
+ origerr = virSaveLastError();
+
if (driver->macFilter) {
int i;
virDomainDefPtr def = vm->def;
@@ -2701,6 +2706,11 @@ retry:
vm->def->id = -1;
vm->newDef = NULL;
}
+
+ if (origerr) {
+ virSetError(origerr);
+ virFreeError(origerr);
+ }
}
Hi Cole,
This looks like a fine series.
Is there an easy way to demonstrate the fix?
Thinking it'd be nice to have a test that exercises at least one piece
of the new code.
One tiny comment: people tend not to comprehend
"wordsthatareattachedlikethis".
So if you rename your "origerr" to e.g., "orig_err",
it will be more readable.
If you decide to make the change, you can do it quickly by doing
something like this (assuming the top 5 changes are the ones in this
series, and they've been rebased to the latest master):
git format-patch --stdout -5 | sed s/origerr/orig_err/ > patch
git co master
git co -b var-rename
git am patch