From: Stefan Schantl Date: Mon, 13 Apr 2020 07:45:43 +0000 (+0200) Subject: general-functions.pl: formatBytes() Fix computing the correct unit. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25932be3e3c99b13fdb27b85dece9ca499ad5212;p=people%2Fms%2Fipfire-2.x.git general-functions.pl: formatBytes() Fix computing the correct unit. Signed-off-by: Stefan Schantl Signed-off-by: Arne Fitzenreiter --- diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 692e072c2a..4c7cf09a8d 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.