The backup.cgi displayed backups smaller than 1KB as 0KB.
authorJan Paul Tuecking <earl@ipfire.org>
Sun, 19 Jul 2009 08:50:16 +0000 (10:50 +0200)
committerJan Paul Tuecking <earl@ipfire.org>
Sun, 19 Jul 2009 08:50:16 +0000 (10:50 +0200)
Now backups smaller than 1KB are shown as 0.xx

html/cgi-bin/backup.cgi

index e1cd922cc42c83a2c332ff1597865ee5e156f5cb..c02056d8b73129563b791db52682d2ae08b61d8a 100644 (file)
@@ -230,9 +230,17 @@ delete $addons{$_};
 my $Datei = "/var/ipfire/backup/addons/backup/".$_.".ipf";
 my @Info = stat($Datei);
 my $Size = $Info[7] / 1024;
-$Size = sprintf("%2d", $Size);
+
 if ( -e $Datei ){
-print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
+       if ($Size < 1) {
+                       $Size = sprintf("%.2f", $Size);
+                       print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
+       } else {
+                       $Size = sprintf("%2d", $Size);
+                       print "<tr><td align='center'>$Lang::tr{'backup from'} $_ $Lang::tr{'size'} $Size KB $Lang::tr{'date'} ".localtime($Info[9])."</td>";
+
+       }
+
 print <<END
        <td align='right' width='5'>
                <form method='post' action='$ENV{'SCRIPT_NAME'}'>