]> xenbits.xensource.com Git - libvirt.git/commitdiff
vz: reset errors after ignoring return values
authorMaxim Nestratov <mnestratov@virtuozzo.com>
Wed, 3 Aug 2016 09:41:53 +0000 (12:41 +0300)
committerMaxim Nestratov <mnestratov@virtuozzo.com>
Thu, 18 Aug 2016 17:37:08 +0000 (20:37 +0300)
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>
src/vz/vz_driver.c
src/vz/vz_sdk.c

index cf4b9e8b03406caeb3ea9fd09b9db8ed2fe6a5c7..2ed12db10a9f413afbd5764e11fd4312576299a5 100644 (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;
 }
 
index 952008ebb693992597221302514189bbeb391a67..999fce16ee82cf7170349018fea0e2d9ff993cfe 100644 (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);
 }