We don't need 'slirpfdName' and 'slirpfd'. The 'slirp' local can be
removed too as qemuSlirpStart is safe to be called if there's nothing to
do.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 src/qemu/qemu_hotplug.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 3f368551e3..0f3b1f4bc4 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1183,8 +1183,6 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
     virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_NET, { .net = net } };
     qemuDomainNetworkPrivate *netpriv = QEMU_DOMAIN_NETWORK_PRIVATE(net);
     virErrorPtr originalError = NULL;
-    g_autofree char *slirpfdName = NULL;
-    int slirpfd = -1;
     g_autoptr(virJSONValue) nicprops = NULL;
     g_autoptr(virJSONValue) netprops = NULL;
     int ret = -1;
@@ -1305,14 +1303,10 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
     case VIR_DOMAIN_NET_TYPE_USER:
         if (!priv->disableSlirp &&
             virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DBUS_VMSTATE)) {
-            qemuSlirp *slirp = NULL;

             if (qemuInterfacePrepareSlirp(driver, net) < 0)
                 goto cleanup;

-            if (!(slirp = QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp))
-                break;
-
             if (qemuSlirpStart(vm, net, NULL) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                "%s", _("Failed to start slirp"));
@@ -1408,7 +1402,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
     }

     if (qemuMonitorAddNetdev(priv->mon, &netprops,
-                             slirpfd, slirpfdName) < 0) {
+                             -1, NULL) < 0) {
         qemuDomainObjExitMonitor(vm);
         virDomainAuditNet(vm, NULL, net, "attach", false);
         goto try_remove;
@@ -1511,7 +1505,6 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
     }

     virDomainCCWAddressSetFree(ccwaddrs);
-    VIR_FORCE_CLOSE(slirpfd);

     return ret;

-- 
2.35.1

Reply via email to