From nobody Mon Feb 9 00:30:46 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=1661271772; cv=none; d=zohomail.com; s=zohoarc; b=dHmxCQV7jlZ+Ji6Miq80iYWGGnWt9hcDY8S5V7Z1aYSGH6L8gDnJHVSV199Moe/YGqhVHNJ4dwCnUKT2ATYI++f/Jm7gzPUq+AdnxI/Kmd9x1OFWnmvaRwFlJRtKb1Ed2AKdo+3ofcRwBBUpHgtyDy2v0+Kz2nOsNk4+8InSDmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661271772; 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; bh=J03L2t2QPn7GsOVgEJTuXlcD/eAat0XXDuWCGynVoQA=; b=nlWWNXl4F8AQS0bIIaP3S7apz35Wq1JxjQDdDZQW8sSRc+w3Zhe8/QHo99myjOYtAA2ue1IqfZ3ELI4U2ZCcLYxF/CeXeUelM++VEZPcUBkQtDL0C4wdjMah4Jh14VFUf3oeiXfADZeJd6CBURvak2N0gGDZJpWQDsuBhj+H/hU= 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 1661271772397898.8822363176623; Tue, 23 Aug 2022 09:22:52 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-439-n9vGTceJN7ONgvf83zsC5A-1; Tue, 23 Aug 2022 12:22:44 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 23074802529; Tue, 23 Aug 2022 16:22:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D41FB2026D4C; Tue, 23 Aug 2022 16:22:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C047D1946A47; Tue, 23 Aug 2022 16:22:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4BEF31946A40 for ; Tue, 23 Aug 2022 16:22:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 214904011A58; Tue, 23 Aug 2022 16:22:39 +0000 (UTC) Received: from nautilus.home.lan (unknown [10.40.192.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A1E840CF8E7; Tue, 23 Aug 2022 16:22:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661271770; h=from:from:sender:sender: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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=J03L2t2QPn7GsOVgEJTuXlcD/eAat0XXDuWCGynVoQA=; b=DrPFb6wdCaH9LbfwMCzHPb0ofBifbkm5CvRKrMYLVOdvbHaNhVpmfhNz1v2iIaR3tenRhZ HK3cLY6YnkSCjMi017LRy5ejlwjFNxOwL36gJqW2GHY+Xeb6zVhEJo8oxgDgGWXQ1pTMJf LKXNDH/zJIcnV2wHhE17E/bBD1jLS0A= X-MC-Unique: n9vGTceJN7ONgvf83zsC5A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH v2 1/2] nwfilter: Replace a redundant 'now' variable with a direct time(0) call Date: Tue, 23 Aug 2022 18:22:36 +0200 Message-Id: <694947e87dc42cc084eb0f6426d716b5b2ed7837.1661271752.git.eskultet@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: eskultet@redhat.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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: 1661271773079100005 Content-Type: text/plain; charset="utf-8"; x-default="true" In this very instance having a variable is pointless since there is only a single time(0) call in the whole function. Signed-off-by: Erik Skultety --- src/nwfilter/nwfilter_dhcpsnoop.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcp= snoop.c index a10a14cfc1..18812c0b20 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -1723,13 +1723,11 @@ virNWFilterSnoopLeaseFileLoad(void) char ipstr[INET_ADDRSTRLEN], srvstr[INET_ADDRSTRLEN]; virNWFilterSnoopIPLease ipl; virNWFilterSnoopReq *req; - time_t now; FILE *fp; int ln =3D 0, tmp; VIR_LOCK_GUARD lock =3D virLockGuardLock(&virNWFilterSnoopState.snoopL= ock); =20 fp =3D fopen(LEASEFILE, "r"); - time(&now); while (fp && fgets(line, sizeof(line), fp)) { if (line[strlen(line)-1] !=3D '\n') { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -1746,7 +1744,7 @@ virNWFilterSnoopLeaseFileLoad(void) "line %d corrupt"), ln); break; } - if (ipl.timeout && ipl.timeout < now) + if (ipl.timeout && ipl.timeout < time(0)) continue; req =3D virNWFilterSnoopReqGetByIFKey(ifkey); if (!req) { --=20 2.37.2