From nobody Wed May 1 23:57:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153727416453429.655049123757635; Tue, 18 Sep 2018 05:36:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B939307D926; Tue, 18 Sep 2018 12:36:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8EDBE30912F5; Tue, 18 Sep 2018 12:36:01 +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 69617180053A; Tue, 18 Sep 2018 12:36:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8ICZvVA017927 for ; Tue, 18 Sep 2018 08:35:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id A99DC450A; Tue, 18 Sep 2018 12:35:57 +0000 (UTC) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EC775E985 for ; Tue, 18 Sep 2018 12:35:52 +0000 (UTC) Received: from cmccmta3.chinamobile.com (cmccmta3.chinamobile.com [221.176.66.81]) by mx1.redhat.com (Postfix) with ESMTP id 79D90307DA3E for ; Tue, 18 Sep 2018 12:35:46 +0000 (UTC) Received: from spf.mail.chinamobile.com (unknown[172.16.121.13]) by rmmx-syy-dmz-app11-12011 (RichMail) with SMTP id 2eeb5ba0f11be71-1e3bb; Tue, 18 Sep 2018 20:35:39 +0800 (CST) Received: from LAPTOPGTD3QV30 (unknown[112.25.154.148]) by rmsmtp-syy-appsvr07-12007 (RichMail) with SMTP id 2ee75ba0f11a7f9-d9652; Tue, 18 Sep 2018 20:35:39 +0800 (CST) X-RM-TRANSID: 2eeb5ba0f11be71-1e3bb X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee75ba0f11a7f9-d9652 From: To: Date: Tue, 18 Sep 2018 20:35:39 +0800 Message-ID: <000001d44f4c$1beca770$53c5f650$@cmss.chinamobile.com> MIME-Version: 1.0 Thread-Index: AdRPSbK8gOTnvZ0JQ/C/OnhQiB4Kag== Content-Language: zh-cn X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 18 Sep 2018 12:35:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 18 Sep 2018 12:35:50 +0000 (UTC) for IP:'221.176.66.81' DOMAIN:'cmccmta3.chinamobile.com' HELO:'cmccmta3.chinamobile.com' FROM:'xiajidong@cmss.chinamobile.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (RCVD_IN_DNSWL_LOW) 221.176.66.81 cmccmta3.chinamobile.com 221.176.66.81 cmccmta3.chinamobile.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] Subject: [PATCH] libvirt-domain.c:virDomainMigrateCheckNotLocal function 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 18 Sep 2018 12:36:03 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" >From c013b053d7514ee66b841bc99900b06d1e9d4dfd Mon Sep 17 00:00:00 2001 From: xiajidong Date: Tue, 18 Sep 2018 08:04:20 -0400 Subject: [PATCH] libvirt-domain.c:virDomainMigrateCheckNotLocal function return bool instead of int type the function of virDomainMigrateCheckNotLocal return bool should be more in line with specification, and use return is better than goto. Signed-off-by: xiajidong --- src/libvirt-domain.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 7690339..d741261 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -3290,25 +3290,25 @@ virDomainMigrateVersion3Params(virDomainPtr domain, } =20 =20 -static int +static bool virDomainMigrateCheckNotLocal(const char *dconnuri) { virURIPtr tempuri =3D NULL; - int ret =3D -1; =20 - if (!(tempuri =3D virURIParse(dconnuri))) - goto cleanup; + if (!(tempuri =3D virURIParse(dconnuri))) { + virURIFree(tempuri); + return false; + } if (!tempuri->server || STRPREFIX(tempuri->server, "localhost")) { virReportInvalidArg(dconnuri, "%s", _("Attempt to migrate guest to the same host")); - goto cleanup; + virURIFree(tempuri); + return false; } =20 - ret =3D 0; =20 - cleanup: virURIFree(tempuri); - return ret; + return ture; } =20 =20 @@ -3428,7 +3428,7 @@ virDomainMigrateUnmanagedParams(virDomainPtr domain, VIR_TYPED_PARAMS_DEBUG(params, nparams); =20 if ((flags & VIR_MIGRATE_PEER2PEER) && - virDomainMigrateCheckNotLocal(dconnuri) < 0) + !virDomainMigrateCheckNotLocal(dconnuri)) return -1; =20 if ((flags & VIR_MIGRATE_PEER2PEER) && --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list