From nobody Wed Apr 15 07:02:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770906258; cv=none; d=zohomail.com; s=zohoarc; b=SxrWjjhPQZkqqrQsLp/djHDuJLfEPPlWCAbqkh8yQQZLyXhSsu1z77JtK/KihSD2+dSQoHAKWddOr45HfECuzuf0+d2QkbkHll5eiruzCmf4mVV3oFTCV0xv3YoHsm8s+bKyu2cp3GZN5bykdXRa1YDvrcER7xOZviW7nq+2QO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770906258; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=058vhunyBPJVgl8lA71l3mKGdfCDcDlZsQKjPx5SCrI=; b=mJ2RPiJNdGaTMclZsKpde5YmeLOXPLjpt5/ipA1TVt5Hw66xNjUnOL0pps9F6/ngWsiZ4aBhFnuF1IYHXUY+vlTnRZB1+zqyu3PqkJ8FB2JCnrhguiWPoqauiOtTKlSTBrF3OvZweDnEoxGaGcxkmuIMNcAZ47a/nzBC2OWjrkM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1770906258936340.41553707864955; Thu, 12 Feb 2026 06:24:18 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 7557B45011; Thu, 12 Feb 2026 09:24:18 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 5A14345753; Thu, 12 Feb 2026 07:53:25 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id C0D2D43FED; Thu, 12 Feb 2026 07:51:51 -0500 (EST) Received: from mx1.osci.io (unknown [8.43.85.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D809846552 for ; Thu, 12 Feb 2026 07:40:19 -0500 (EST) Received: by mx1.osci.io (Postfix, from userid 995) id D16642BDD5; Wed, 11 Feb 2026 15:21:20 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mx1.osci.io (Postfix) with ESMTPS id 4E3C62BDD2 for ; Wed, 11 Feb 2026 15:21:20 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-94-hQRLPMMcM_SqaRvTTptLIg-1; Wed, 11 Feb 2026 15:20:44 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 53FF819560AF for ; Wed, 11 Feb 2026 20:20:43 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.45.227.9]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3DA7F300DDA5; Wed, 11 Feb 2026 20:20:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770841245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=058vhunyBPJVgl8lA71l3mKGdfCDcDlZsQKjPx5SCrI=; b=Ddb6hD0I+/RhPPWPoCr5+E4midtaOpHRloIOCBLA/JZC2xUyHvj0yDUPu1HctaXyg6k7Ga 6K7+FZBqDweuL4qHySmcXLjJKevgvlEgT2wZhipJqAQxJC5EDvNqRufcpG7BnCCkfG1H2u Co0SqUQRaVee7Xt9nLFL7fJ3pnP+XBQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770841279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=058vhunyBPJVgl8lA71l3mKGdfCDcDlZsQKjPx5SCrI=; b=fRYxiCgW42kXbDtEI/EHSAhk5YOPaqcQXAAl62/c7j/4rcfMmQrczYOVuGt5jgeIMp2Nwa 6Dyvqeh3ygK13D83GWJLUSd/qYOsEck8TpdS/XmCJaO+HEFS2REZgs1Xt0qA/cOJpybcuN 5BqQNkA9GTBj/HbIBrJs7gY/PoFeDcU= X-MC-Unique: hQRLPMMcM_SqaRvTTptLIg-1 X-Mimecast-MFC-AGG-ID: hQRLPMMcM_SqaRvTTptLIg_1770841243 To: devel@lists.libvirt.org Subject: [PATCH] util: remove duplicate logging of firewall command Date: Wed, 11 Feb 2026 20:20:40 +0000 Message-ID: <20260211202040.1223840-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: gJjvB-SomB0isChv2j2Z4jOGucVP11gixRHIHHlmQOs_1770841243 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GS6SRLBERBOVD3PB7XQCAB27W2KSXLD2 X-Message-ID-Hash: GS6SRLBERBOVD3PB7XQCAB27W2KSXLD2 X-MailFrom: berrange@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9_via_Devel?= Reply-To: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= X-ZohoMail-DKIM: fail (found 2 invalid signatures) X-ZM-MESSAGEID: 1770906260665154100 From: Daniel P. Berrang=C3=A9 The vircommand.c code will always log the argv about to be run, so logging it again in virfirewall.c is redundant. Removing the dupe avoids the repeated memory allocation from the array -> string conversion. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/util/virfirewall.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index 69521e2b46..a64f8b69c7 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -571,7 +571,6 @@ virFirewallCmdIptablesApply(virFirewall *firewall, VIR_FIREWALL_TRANSACTION_AUTO_ROLLBACK); bool needRollback =3D false; g_autoptr(virCommand) cmd =3D NULL; - g_autofree char *cmdStr =3D NULL; g_autofree char *error =3D NULL; size_t i; int status; @@ -607,9 +606,6 @@ virFirewallCmdIptablesApply(virFirewall *firewall, virCommandAddArg(cmd, fwCmd->args[i]); } =20 - cmdStr =3D virCommandToString(cmd, false); - VIR_INFO("Running firewall command '%s'", NULLSTR(cmdStr)); - virCommandSetOutputBuffer(cmd, output); virCommandSetErrorBuffer(cmd, &error); =20 @@ -622,6 +618,7 @@ virFirewallCmdIptablesApply(virFirewall *firewall, VIR_DEBUG("Ignoring error running command"); return 0; } else { + g_autofree char *cmdStr =3D virCommandToString(cmd, false); virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to run firewall command %1$s: %2$s"), NULLSTR(cmdStr), NULLSTR(error)); @@ -671,7 +668,6 @@ virFirewallCmdNftablesApply(virFirewall *firewall G_GNU= C_UNUSED, size_t cmdIdx =3D 0; const char *objectType =3D NULL; g_autoptr(virCommand) cmd =3D NULL; - g_autofree char *cmdStr =3D NULL; g_autofree char *error =3D NULL; size_t i; int status; @@ -727,9 +723,6 @@ virFirewallCmdNftablesApply(virFirewall *firewall G_GNU= C_UNUSED, for (i =3D 0; i < fwCmd->argsLen; i++) virCommandAddArg(cmd, fwCmd->args[i]); =20 - cmdStr =3D virCommandToString(cmd, false); - VIR_INFO("Applying '%s'", NULLSTR(cmdStr)); - virCommandSetOutputBuffer(cmd, output); virCommandSetErrorBuffer(cmd, &error); =20 @@ -745,6 +738,7 @@ virFirewallCmdNftablesApply(virFirewall *firewall G_GNU= C_UNUSED, } else if (fwCmd->ignoreErrors) { VIR_DEBUG("Ignoring error running command"); } else { + g_autofree char *cmdStr =3D virCommandToString(cmd, false); virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to apply firewall command '%1$s': %2$= s"), NULLSTR(cmdStr), NULLSTR(error)); @@ -776,6 +770,7 @@ virFirewallCmdNftablesApply(virFirewall *firewall G_GNU= C_UNUSED, } =20 if (!handleLen) { + g_autofree char *cmdStr =3D virCommandToString(cmd, false); virReportError(VIR_ERR_INTERNAL_ERROR, _("couldn't register rollback command - command= '%1$s' had no valid handle in output ('%2$s')"), NULLSTR(cmdStr), NULLSTR(*output)); --=20 2.53.0