From 4e7b3b1ebd9037af9d8d66a329d2e163dae0b1be Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Thu, 6 Dec 2018 12:32:06 -0500 Subject: [PATCH] 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 --- src/conf/domain_conf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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; }