conf: Use consistent error preservation and restoration calls

Provide some consistency over error message variable name and usage
when saving error messages across possible other errors or possibility
of resetting of the last error.

Instead of virSaveLastError paired up with virSetError and virFreeError,
we should use the newer virErrorPreserveLast and virRestoreError.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
John Ferlan 2018-12-06 12:32:06 -05:00
parent 382c762c45
commit 4e7b3b1ebd
1 changed files with 2 additions and 5 deletions

View File

@ -23563,17 +23563,14 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr src,
return true;
error:
err = virSaveLastError();
virErrorPreserveLast(&err);
strSrc = virDomainDefFormat(src, NULL, 0);
strDst = virDomainDefFormat(dst, NULL, 0);
VIR_DEBUG("XMLs that failed stability check were: src=\"%s\", dst=\"%s\"",
NULLSTR(strSrc), NULLSTR(strDst));
if (err) {
virSetError(err);
virFreeError(err);
}
virErrorRestore(&err);
return false;
}