From nobody Sat Feb 7 09:36:38 2026 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 1536551296119519.7501660187861; Sun, 9 Sep 2018 20:48:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 66F103082137; Mon, 10 Sep 2018 03:48:13 +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 EC91560BE1; Mon, 10 Sep 2018 03:48:12 +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 B0E53181A12E; Mon, 10 Sep 2018 03:48:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8A3m513021318 for ; Sun, 9 Sep 2018 23:48:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id EFCE460BE8; Mon, 10 Sep 2018 03:48:05 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E63D060BE1 for ; Mon, 10 Sep 2018 03:48:03 +0000 (UTC) Received: from m50211.mail.qiye.163.com (m50211.mail.qiye.163.com [123.125.50.211]) by mx1.redhat.com (Postfix) with ESMTP id 0B401307D912 for ; Mon, 10 Sep 2018 03:48:02 +0000 (UTC) Received: from localhost.localdomain (unknown [58.56.27.130]) by smtp3 (Coremail) with SMTP id PdOowEDZhkJu6ZVb8BUdAg--.502S8; Mon, 10 Sep 2018 11:48:01 +0800 (CST) From: Shi Lei To: libvir-list@redhat.com Date: Mon, 10 Sep 2018 11:47:55 +0800 Message-Id: <20180910034755.31246-7-shi_lei@massclouds.com> In-Reply-To: <20180910034755.31246-1-shi_lei@massclouds.com> References: <20180910034755.31246-1-shi_lei@massclouds.com> X-CM-TRANSID: PdOowEDZhkJu6ZVb8BUdAg--.502S8 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjTRxMa0DUUUU X-Originating-IP: [58.56.27.130] X-CM-SenderInfo: pvklsz1hl6ztxvvfz0xxgvhudrp/1tbidxG9T1n5eGHpBAAAsA X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 212 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 10 Sep 2018 03:48:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 10 Sep 2018 03:48:02 +0000 (UTC) for IP:'123.125.50.211' DOMAIN:'m50211.mail.qiye.163.com' HELO:'m50211.mail.qiye.163.com' FROM:'shi_lei@massclouds.com' RCPT:'' X-RedHat-Spam-Score: -0.01 (RCVD_IN_DNSWL_NONE) 123.125.50.211 m50211.mail.qiye.163.com 123.125.50.211 m50211.mail.qiye.163.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/6] uml: conf: use VIR_AUTOCLOSE instead of VIR_FORCE_CLOSE 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 10 Sep 2018 03:48:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" By making use of GNU C's cleanup attribute handled by the VIR_AUTOCLOSE mac= ro, many of the VIR_FORCE_CLOSE calls can be dropped, which in turn leads to getting rid of many of our cleanup sections. =20 Signed-off-by: Shi Lei --- src/uml/uml_conf.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index f116e61..da0dc69 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -112,14 +112,14 @@ umlConnectTapDevice(virDomainDefPtr vm, const char *bridge) { bool template_ifname =3D false; - int tapfd =3D -1; + VIR_AUTOCLOSE(tapfd); =20 if (!net->ifname || STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) || strchr(net->ifname, '%')) { VIR_FREE(net->ifname); if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0) - goto error; + return -1; /* avoid exposing vnet%d in getXMLDesc or error outputs */ template_ifname =3D true; } @@ -133,23 +133,18 @@ umlConnectTapDevice(virDomainDefPtr vm, VIR_NETDEV_TAP_CREATE_PERSIST) < 0)= { if (template_ifname) VIR_FREE(net->ifname); - goto error; + return -1; } =20 if (net->filter) { if (virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net, fals= e) < 0) { if (template_ifname) VIR_FREE(net->ifname); - goto error; + return -1; } } =20 - VIR_FORCE_CLOSE(tapfd); return 0; - - error: - VIR_FORCE_CLOSE(tapfd); - return -1; } =20 static char * --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list