]> xenbits.xensource.com Git - libvirt.git/commitdiff
networkStartNetworkVirtual: Dissolve 'err4' label in 'error'
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 23 Apr 2019 14:44:59 +0000 (16:44 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 21 May 2019 11:47:10 +0000 (13:47 +0200)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/network/bridge_driver.c

index ef82a3e31077afb5285b8744f8937a4ab9f8bdec..88e49969b5c03609c2e5afaf976959507f9112df 100644 (file)
@@ -2335,7 +2335,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
     virMacMapPtr macmap;
     char *macMapFile = NULL;
     int tapfd = -1;
-    pid_t dnsmasqPid;
+    bool dnsmasqStarted = false;
 
     /* Check to see if any network IP collides with an existing route */
     if (networkCheckRouteCollision(def) < 0)
@@ -2465,22 +2465,24 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
         networkStartDhcpDaemon(driver, obj) < 0)
         goto err3;
 
+    dnsmasqStarted = true;
+
     /* start radvd if there are any ipv6 addresses */
     if (v6present && networkStartRadvd(driver, obj) < 0)
-        goto err4;
+        goto error;
 
     /* dnsmasq does not wait for DAD to complete before daemonizing,
      * so we need to wait for it ourselves.
      */
     if (v6present && networkWaitDadFinish(obj) < 0)
-        goto err4;
+        goto error;
 
     /* DAD has finished, dnsmasq is now bound to the
      * bridge's IPv6 address, so we can set the dummy tun down.
      */
     if (tapfd >= 0) {
         if (virNetDevSetOnline(macTapIfName, false) < 0)
-            goto err4;
+            goto error;
         VIR_FORCE_CLOSE(tapfd);
     }
 
@@ -2497,12 +2499,8 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
     if (def->bandwidth)
        virNetDevBandwidthClear(def->bridge);
 
- err4:
-    if (!save_err)
-        virErrorPreserveLast(&save_err);
-
-    dnsmasqPid = virNetworkObjGetDnsmasqPid(obj);
-    if (dnsmasqPid > 0) {
+    if (dnsmasqStarted) {
+        pid_t dnsmasqPid = virNetworkObjGetDnsmasqPid(obj);
         kill(dnsmasqPid, SIGTERM);
         virNetworkObjSetDnsmasqPid(obj, -1);
     }