From 0f13dc81d717fc27acae0856ce496f88b84da34d Mon Sep 17 00:00:00 2001 From: Maxim Nestratov Date: Wed, 3 Aug 2016 12:41:53 +0300 Subject: [PATCH] vz: reset errors after ignoring return values If we are going to ignore return value of a functions that can raise an error, it's not enough to use ignore_value construction. We should explicitly call virResetLastError Signed-off-by: Maxim Nestratov --- src/vz/vz_driver.c | 5 +++++ src/vz/vz_sdk.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index cf4b9e8b03..2ed12db10a 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -331,6 +331,11 @@ vzDriverObjNew(void) driver->hostsysinfo = virSysinfoRead(); ignore_value(prlsdkLoadDomains(driver)); + + /* As far as waitDomainJob finally calls virReportErrorHelper + * and we are not going to report it, reset it expicitly*/ + virResetLastError(); + return driver; } diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 952008ebb6..999fce16ee 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -3114,6 +3114,9 @@ static int prlsdkConfigureGateways(PRL_HANDLE sdknet, virDomainNetDefPtr net) ? VIR_SOCKET_ADDR_IPV4_ALL : VIR_SOCKET_ADDR_IPV6_ALL), VIR_SOCKET_ADDR_FAMILY(addrdst))); + /* virSocketAddrParse raises an error + * and we are not going to report it, reset it expicitly*/ + virResetLastError(); if (!virSocketAddrEqual(addrdst, &zero)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -3360,6 +3363,10 @@ prlsdkCleanupBridgedNet(vzDriverPtr driver, job = PrlSrv_DeleteVirtualNetwork(driver->server, vnet, 0); ignore_value(waitDomainJob(job, dom)); + /* As far as waitDomainJob finally calls virReportErrorHelper + * and we are not going to report it, reset it expicitly*/ + virResetLastError(); + cleanup: PrlHandle_Free(vnet); } -- 2.39.5