diff options
Diffstat (limited to 'perl-install/resize_fat/any.pm')
-rw-r--r-- | perl-install/resize_fat/any.pm | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/perl-install/resize_fat/any.pm b/perl-install/resize_fat/any.pm index f811e7159..fc3c438eb 100644 --- a/perl-install/resize_fat/any.pm +++ b/perl-install/resize_fat/any.pm @@ -1,4 +1,4 @@ -package resize_fat::any; # $Id$ +package resize_fat::any; use diagnostics; use strict; @@ -23,11 +23,11 @@ $UNMOVEABLE = 8; #- returns the number of clusters for a given filesystem type sub min_cluster_count($) { my ($fs) = @_; - (1 << $ {{ FAT16 => 12, FAT32 => 12 }}{$fs->{fs_type}}) - 12; + (1 << ${{ FAT16 => 12, FAT32 => 12 }}{$fs->{fs_type}}) - 12; } sub max_cluster_count($) { my ($fs) = @_; - (1 << $ {{ FAT16 => 16, FAT32 => 28 }}{$fs->{fs_type}}) - 11; + (1 << ${{ FAT16 => 16, FAT32 => 28 }}{$fs->{fs_type}}) - 11; } @@ -86,7 +86,15 @@ sub max_size($) { sub used_size($) { my ($fs) = @_; - my $used_cluster_count = max(last_used($fs), min_cluster_count($fs)); + my $last_used; + my $used_cluster_count; + + eval { $last_used = last_used($fs) }; + if ($@) { + # Empty FAT + $last_used = 0; + } + $used_cluster_count = max($last_used, min_cluster_count($fs)); $used_cluster_count * divide($fs->{cluster_size}, $SECTORSIZE) + divide($fs->{cluster_offset}, $SECTORSIZE); @@ -110,7 +118,6 @@ sub flag_clusters { } else { return } my $nb = resize_fat::c_rewritten::checkFat($cluster, $type, "$curr_dir_name/$entry->{name}"); - print "resize_fat:flag_clusters: check fat returned $nb of type $type for $curr_dir_name/$entry->{name}\n"; $nb_dirs += $nb if $type == $DIRECTORY; 0; }; |