From nobody Sun Feb 8 17:46:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1644582655; cv=none; d=zohomail.com; s=zohoarc; b=a8mZK4UV81zXGdxH7TGOYZF68SP/uB1+PSoW7j81yR+4LEnf8vSaOfUx3gNucEfA1+qrIwr07xnP8lIU6neS6tEF5GNVjdL/rudrHgIqTqLw+fv/ccXgue4Yr67GZ4CzbqXXcFBn5jzTx+3EHgXdA3vDjwwyxAic9Mg+gKCD4fc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644582655; 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=QhCNqaxnWuA1a3IgrYykcNuQxOhdkkqe8eFcwtYAdhs=; b=aS0/QXEYCDB0xIffmDJwMACtxHS2u+6ttAhLkzHeuXM5YUQkpZruBcE8daOoNnHCBzc7hKkbfFG2f4CDMGBoPiQjjKNwzmjHiUQWRaa/r2nOpuc7rWeBABCfJqfLkwWHr5ukL6prtA2dbzhL0uduB5Qb680ogTg0UYEhVjNWoHw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 16445826550291012.3062203388349; Fri, 11 Feb 2022 04:30:55 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-281-JJcIunIMPpW5wseuhB8M3w-1; Fri, 11 Feb 2022 07:30:50 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0A4EF1854E36; Fri, 11 Feb 2022 12:30:42 +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 DAD301059139; Fri, 11 Feb 2022 12:30:41 +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 8FE4B4A7C8; Fri, 11 Feb 2022 12:30:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21BCUaiv008944 for ; Fri, 11 Feb 2022 07:30:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id B13811059110; Fri, 11 Feb 2022 12:30:36 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39D5C105910E for ; Fri, 11 Feb 2022 12:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644582652; 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=QhCNqaxnWuA1a3IgrYykcNuQxOhdkkqe8eFcwtYAdhs=; b=KtYjeg8mCGziR3SeAvqKOzHqtE9F7ekRMxLki2PZZ5cIrcY+IGfNPRFu9lNj2nFhhlaW+x s0+tjzqnmPyyIM1ZKJKqNfiYYDDYjXMcnP5aexA19Q8l2GEQAsbZoeEcs4IBDASV700wR9 dUaXc0cs+epbf/O1MsIZcyrFzCRofUk= X-MC-Unique: JJcIunIMPpW5wseuhB8M3w-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 4/5] qemuPrepareNVRAM: Switch to VIR_AUTOCLOSE Date: Fri, 11 Feb 2022 13:30:28 +0100 Message-Id: <9e13d60e337ae9abf7e05b2c57adbaaa3d20d70f.1644582486.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644582656786100001 Content-Type: text/plain; charset="utf-8" Nothing inside the qemuPrepareNVRAM function relies on @srcFD being closed early and nothing closes it early. It's okay then to close it automatically when leaving the function. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_process.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 036d95924c..0ba9343b2a 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4463,7 +4463,7 @@ qemuPrepareNVRAM(virQEMUDriver *driver, { g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); int ret =3D -1; - int srcFD =3D -1; + VIR_AUTOCLOSE srcFD =3D -1; virDomainLoaderDef *loader =3D vm->def->os.loader; const char *master_nvram_path; struct qemuPrepareNVRAMHelperData data; @@ -4511,7 +4511,6 @@ qemuPrepareNVRAM(virQEMUDriver *driver, =20 ret =3D 0; cleanup: - VIR_FORCE_CLOSE(srcFD); return ret; } =20 --=20 2.34.1