]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
general-functions.pl: formatBytes() Fix computing the correct unit.
authorStefan Schantl <stefan.schantl@ipfire.org>
Mon, 13 Apr 2020 07:45:43 +0000 (09:45 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Fri, 1 May 2020 19:14:36 +0000 (19:14 +0000)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
config/cfgroot/general-functions.pl

index 692e072c2ac9e439ebfbc54fddbc5d07b27e0c60..4c7cf09a8db394db903970daa156dc6e18d6c1d9 100644 (file)
@@ -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.