From nobody Sat Feb 7 10:44:44 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=1571161071; cv=none; d=zoho.com; s=zohoarc; b=gO2p9L0BBNhH7jqdQUjq36f0s0gKO6NPz5n7/Fq8ijiTtAKn5f+/lGEMu5ekBqwwbwbJlxHg/WRUFazY6eZGrQ5CduCAD4j0ZOxZTScHaJp5zKj72JGA9pwrARxIcjKLBxkRTYvjaXA+D5tAQuqwAzKQbBZQ4Ax7cpTHbjD1jMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571161071; 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=rX2FEZjcUqW5ehOEcULfikvkVzjc7cB8NHRi3ZFHCWI=; b=AdnS2VxrYbcbuAVVqTiGrnnM13vUu2PSq2dEJ7AkbYxnqLR5cFohbSp7OLEDvDC2lBtTqxxLARqDLGwGaAtu/NXgy7Gy1HWqw6KpgD4bKYQJYpujz18kuFAMRdGTygdNPsaPSA9ohSmqAxhg30fW0GW1xFWv5pGx21nUk4G41CE= 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 1571161071779883.8565177811472; Tue, 15 Oct 2019 10:37:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2F1F9305FD51; Tue, 15 Oct 2019 17:37:50 +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 022855C548; Tue, 15 Oct 2019 17:37:50 +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 B587418037CA; Tue, 15 Oct 2019 17:37:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9FHbb3S001221 for ; Tue, 15 Oct 2019 13:37:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2C3555D9E2; Tue, 15 Oct 2019 17:37:37 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.com (ovpn-116-31.phx2.redhat.com [10.3.116.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF1B95D9CD for ; Tue, 15 Oct 2019 17:37:36 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 15 Oct 2019 13:37:22 -0400 Message-Id: <20191015173728.1633-5-jferlan@redhat.com> In-Reply-To: <20191015173728.1633-1-jferlan@redhat.com> References: <20191015173728.1633-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/10] lxc: Use consistent error preservation and restoration calls 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.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 15 Oct 2019 17:37:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Provide some consistency over error message variable name and usage when saving error messages across possible other errors or possibility of resetting of the last error. Instead of virSaveLastError paired up with virSetError and virFreeError, we should use the newer virErrorPreserveLast and virRestoreError. Signed-off-by: John Ferlan --- src/lxc/lxc_driver.c | 9 ++++----- src/lxc/lxc_process.c | 7 ++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 5c7a9140b2..204a3ed522 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1857,12 +1857,11 @@ static int lxcSetVcpuBWLive(virCgroupPtr cgroup, un= signed long long period, =20 error: if (period) { - virErrorPtr saved =3D virSaveLastError(); + virErrorPtr saved; + + virErrorPreserveLast(&saved); virCgroupSetCpuCfsPeriod(cgroup, old_period); - if (saved) { - virSetError(saved); - virFreeError(saved); - } + virErrorRestore(&saved); } =20 return -1; diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index da0b055b85..d9939f102d 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -1568,7 +1568,7 @@ int virLXCProcessStart(virConnectPtr conn, rc =3D -1; } if (rc !=3D 0) { - err =3D virSaveLastError(); + virErrorPreserveLast(&err); virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED); } virCommandFree(cmd); @@ -1582,10 +1582,7 @@ int virLXCProcessStart(virConnectPtr conn, virObjectUnref(cfg); virObjectUnref(caps); =20 - if (err) { - virSetError(err); - virFreeError(err); - } + virErrorRestore(&err); =20 return rc; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list