From nobody Sun Feb 8 10:03:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1598971065; cv=none; d=zohomail.com; s=zohoarc; b=niLZ73ew6InwuE6jO2wMpbxXYjwyo5LSqQgQUrXqs0Vu1ds51G5381r+IRBFrTFm/rme/NPKmX8IIBVYcPhzQ3HhvWgSf/PFDOxxkwIVFHzrNk7mcTpM0ShHBUlpWvkaFcbITaS8RUSwquaGGpfhWG0d+hZkwlZMjWLt8++P11M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598971065; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iklfdl5AH/xUGGgg71Ak1SvK5sx/D1GfbdDUYqPt5ZY=; b=ejRTDzcC3wOihbxUk9x75xNEvl0EB6CMDZAjIt79zhdrvMxo7eRlqsojXD7Oer3q0K/tDszRpCRkKFRnojqucC/8K9I4YJFa5slIZWR4jUvrcy/VknXFelILZyXds2kQqmUYCfnTadoUcxMMppdfhJ9NdgV3Z2K8/5K49t8z3Pc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 159897106523043.91333559833629; Tue, 1 Sep 2020 07:37:45 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-530-dNgipLLrO9KU60vBCKkocQ-1; Tue, 01 Sep 2020 10:37:39 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 59881189E604; Tue, 1 Sep 2020 14:37:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3B7807EB87; Tue, 1 Sep 2020 14:37:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 085A07A317; Tue, 1 Sep 2020 14:37:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 081Eb9Hc016575 for ; Tue, 1 Sep 2020 10:37:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id B13EE7EB8F; Tue, 1 Sep 2020 14:37:09 +0000 (UTC) Received: from wheatley.localdomain (unknown [10.40.195.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8355A7EB87 for ; Tue, 1 Sep 2020 14:37:06 +0000 (UTC) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 5B7B87E0078 for ; Tue, 1 Sep 2020 16:37:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598971063; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=iklfdl5AH/xUGGgg71Ak1SvK5sx/D1GfbdDUYqPt5ZY=; b=IDUvNCNTj6djyehu+ifyuTX4hnUeCKi7iqY4tUC0/3XhLeDrzbVk+NQA5OyETWxhIzD9fo NI2uHwK0a5+PR3Hg01lTtWp7+DghrhogP1fv01623NGXSdETn+Srx81A7b2tKxJ6ZdC8et Jvvis1pclOrnRztRr8gs6Mn+bu5EUEw= X-MC-Unique: dNgipLLrO9KU60vBCKkocQ-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH v2 2/9] qemu: Rework qemuMigrationSrcConnect Date: Tue, 1 Sep 2020 16:36:53 +0200 Message-Id: <4a6df3cec0b13e512bf05dbfcb6e1da2749173da.1598970960.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Instead of saving some data from a union up front and changing an overlayed struct before using said data, let's just set the new values after they are decided. This will increase the readability of future commit(s). Signed-off-by: Martin Kletzander Reviewed-by: Jiri Denemark --- src/qemu/qemu_migration.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 60ddfde65d46..1a3cdb71f424 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3368,24 +3368,24 @@ qemuMigrationSrcConnect(virQEMUDriverPtr driver, qemuMigrationSpecPtr spec) { virNetSocketPtr sock; - const char *host; g_autofree char *port =3D NULL; + int fd_qemu =3D -1; int ret =3D -1; =20 - host =3D spec->dest.host.name; - port =3D g_strdup_printf("%d", spec->dest.host.port); - - spec->destType =3D MIGRATION_DEST_FD; - spec->dest.fd.qemu =3D -1; - if (qemuSecuritySetSocketLabel(driver->securityManager, vm->def) < 0) goto cleanup; - if (virNetSocketNewConnectTCP(host, port, + port =3D g_strdup_printf("%d", spec->dest.host.port); + if (virNetSocketNewConnectTCP(spec->dest.host.name, + port, AF_UNSPEC, &sock) =3D=3D 0) { - spec->dest.fd.qemu =3D virNetSocketDupFD(sock, true); + fd_qemu =3D virNetSocketDupFD(sock, true); virObjectUnref(sock); } + + spec->destType =3D MIGRATION_DEST_FD; + spec->dest.fd.qemu =3D fd_qemu; + if (qemuSecurityClearSocketLabel(driver->securityManager, vm->def) < 0= || spec->dest.fd.qemu =3D=3D -1) goto cleanup; --=20 2.28.0