From: John Ferlan Date: Thu, 6 Dec 2018 17:32:06 +0000 (-0500) Subject: conf: Use consistent error preservation and restoration calls X-Git-Tag: v5.9.0-rc1~190 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e7b3b1ebd9037af9d8d66a329d2e163dae0b1be;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Michal Privoznik --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6cb7156664..2e6a113de3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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; }