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 <mnestratov@virtuozzo.com>
This commit is contained in:
Maxim Nestratov 2016-08-03 12:41:53 +03:00
parent d9e0d4ecbb
commit 0f13dc81d7
2 changed files with 12 additions and 0 deletions

View File

@ -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;
}

View File

@ -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);
}