[PATCH v1] network: Convert to virErrorRestore/virErrorPreserveLast

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Replaced usage of virSaveLastError and virSetError/virFreeError with 
virErrorPreserveLast and virErrorRestore respectively.

Signed-off-by: Syed Humaid <syedhumaidbinharoon@xxxxxxxxx>
---
 src/network/bridge_driver.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index f824b8b4f3..dc21ac642c 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2495,7 +2495,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
 
  err4:
     if (!save_err)
-        save_err = virSaveLastError();
+        virErrorPreserveLast(&save_err);
 
     dnsmasqPid = virNetworkObjGetDnsmasqPid(obj);
     if (dnsmasqPid > 0) {
@@ -2505,18 +2505,18 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
 
  err3:
     if (!save_err)
-        save_err = virSaveLastError();
+        virErrorPreserveLast(&save_err);
     ignore_value(virNetDevSetOnline(def->bridge, 0));
 
  err2:
     if (!save_err)
-        save_err = virSaveLastError();
+        virErrorPreserveLast(&save_err);
     if (def->forward.type != VIR_NETWORK_FORWARD_OPEN)
         networkRemoveFirewallRules(def);
 
  err1:
     if (!save_err)
-        save_err = virSaveLastError();
+        virErrorPreserveLast(&save_err);
 
     if (macTapIfName) {
         VIR_FORCE_CLOSE(tapfd);
@@ -2528,13 +2528,10 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
 
  err0:
     if (!save_err)
-        save_err = virSaveLastError();
+        virErrorPreserveLast(&save_err);
     ignore_value(virNetDevBridgeDelete(def->bridge));
 
-    if (save_err) {
-        virSetError(save_err);
-        virFreeError(save_err);
-    }
+    virErrorRestore(&save_err);
     /* coverity[leaked_handle] - 'tapfd' is not leaked */
     return -1;
 }
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux