From nobody Mon Feb 9 23:43:00 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565923416; cv=none; d=zoho.com; s=zohoarc; b=DpDB1p9kr5GtpA7bzq44J61mMBfxEczlcVZb+ADcgxgCQrS2Kj4LN7w/eBB8W8r5uaDh58ND3iUZ6mffEUuzR3p9cXoYwy30ZzQq/U9S7Nf6aeMYO2a0v7Lw5/QTI+0yhhBZqsKQlcT8X0GVDjDuN4Cfnd/sov3EsW3R5p/TByI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565923416; h=Content-Type:Content-Transfer-Encoding:Cc: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:ARC-Authentication-Results; bh=sdu70JIw+yRk5syGLPoChCEX6jFG9jFrBPiHggEWIUs=; b=iwMRbkBB3jLwKQGFIN+CquuwNd03Rzmts/wIRhzKzbSqa7wLwp1MqZn63yaMnf9e21lBWgYYDz+3Hled2yQvlkGEM0LTWbAc/34KXO7zihutdQjJWJkSZsH35HxSlWJZs/2qd5819OO9xkSFqYyb6HAk1GBaJkrwbBfpGTF0CIw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565923416140807.9541888723386; Thu, 15 Aug 2019 19:43:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C37913082A98; Fri, 16 Aug 2019 02:43:34 +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 A16FF43FDB; Fri, 16 Aug 2019 02:43: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 6B986180085A; Fri, 16 Aug 2019 02:43:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7G2g9Ck030304 for ; Thu, 15 Aug 2019 22:42:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4238984252; Fri, 16 Aug 2019 02:42:09 +0000 (UTC) Received: from vhost2.laine.org (ovpn-117-27.phx2.redhat.com [10.3.117.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD74B841FD; Fri, 16 Aug 2019 02:42:08 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Thu, 15 Aug 2019 22:42:00 -0400 Message-Id: <20190816024200.29474-3-laine@redhat.com> In-Reply-To: <20190816024200.29474-1-laine@redhat.com> References: <20190816024200.29474-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: yalzhang@redhat.com Subject: [libvirt] [PATCH 2/2] network: replace virSaveLastError() with virErrorPreserveLast() 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 16 Aug 2019 02:43:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" virErrorPreserveLast()/virErrorRestore() (added in commit 8333e7455 back in 2017), do a better better job of saving and restoring the last libvirt error than virSaveLastError()/virErrorRestore() (they're simpler, and they also save/restore the system errno). Signed-off-by: Laine Stump --- src/network/bridge_driver.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index dae1def8de..9059296e55 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2987,13 +2987,12 @@ networkStartNetwork(virNetworkDriverStatePtr driver, =20 cleanup: if (ret < 0) { + virErrorPtr save_err; + + virErrorPreserveLast(&save_err); virNetworkObjUnsetDefTransient(obj); - virErrorPtr save_err =3D virSaveLastError(); - int save_errno =3D errno; networkShutdownNetwork(driver, obj); - virSetError(save_err); - virFreeError(save_err); - errno =3D save_errno; + virErrorRestore(&save_err); } return ret; } @@ -5596,13 +5595,13 @@ networkPortCreateXML(virNetworkPtr net, goto cleanup; =20 if (virNetworkObjAddPort(obj, portdef, driver->stateDir) < 0) { - virErrorPtr saved; + virErrorPtr save_err; =20 - saved =3D virSaveLastError(); + virErrorPreserveLast(&save_err); ignore_value(networkReleasePort(obj, portdef)); virNetworkPortDefFree(portdef); - virSetError(saved); - virFreeError(saved); + virErrorRestore(&save_err); + goto cleanup; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list