From patchwork Mon Apr 13 07:45:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 2953 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4910zy4lTZz3yC0 for ; Mon, 13 Apr 2020 07:46:22 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4910zl2kRFz2qG; Mon, 13 Apr 2020 07:46:11 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4910zl1pyFz30FQ; Mon, 13 Apr 2020 07:46:11 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4910zf3tJhz30F8 for ; Mon, 13 Apr 2020 07:46:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 4910zb26mbz2l5; Mon, 13 Apr 2020 07:46:03 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1586763963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y8n8ipwOLVMv3HG9X0auOAPjBvWq/KNQ0CATclO2Q+o=; b=rHEhvvN25qwTyPbK+Q+g59FjQTUBqw3JtN+Ltnh1xK5OI6Ap1a9qy2E0S8ILYF3Osuu8AB cx2Et8HvnmoK83BA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1586763963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y8n8ipwOLVMv3HG9X0auOAPjBvWq/KNQ0CATclO2Q+o=; b=G+YZpQjmqgS1TqxxJk7eHet5mG9HbidTWaKT+f4dr0wGMkh9j/01bgjOjIlBr14uBadeTC 9SU8j6yU7kUh05oCa++D9NyZEZYzkbp6pomWk090aBI3JVzsCPGs9aAz3Iqr2d/hgVu9Hf BTomFLwCGCLJA51NHEPnAljzI8kh8/9DKeK5O1CxzJri/nY8Qv5S/bZvk7JvTht8K0ZDRE W9JlbnKyo0oTFhralxnbDAd73pU0ksN7Z+jz+NrXBxjZCKtj3Mfuvd66IB9bjFRxoFzVSC CRqUxtGHhEuDlG/TOcWQ1htnrAL10R4+cKvQxDqRTL9e0I2foEEitget2TVEYw== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 12/19] general-functions.pl: formatBytes() Fix computing the correct unit. Date: Mon, 13 Apr 2020 09:45:43 +0200 Message-Id: <20200413074550.2735-12-stefan.schantl@ipfire.org> In-Reply-To: <20200413074550.2735-1-stefan.schantl@ipfire.org> References: <20200413074550.2735-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Stefan Schantl --- config/cfgroot/general-functions.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 692e072c2..4c7cf09a8 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -1272,14 +1272,14 @@ sub formatBytes { # Loop through the array of units. foreach my $element (@units) { + # Assign current processed element to unit. + $unit = $element; + # Break loop if the bytes are less than the next unit. last if $bytes < 1024; # Divide bytes amount with 1024. $bytes /= 1024; - - # Assign current processed element to unit. - $unit = $element; } # Return the divided and rounded bytes count and the unit.