summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table_raw.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/partition_table_raw.pm')
-rw-r--r--perl-install/partition_table_raw.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm
index a27947bdd..af73da1d1 100644
--- a/perl-install/partition_table_raw.pm
+++ b/perl-install/partition_table_raw.pm
@@ -76,10 +76,11 @@ sub get_geometry($) {
my %geom; @geom{qw(heads sectors cylinders start)} = unpack "CCSL", $g;
#- $geom{cylinders} is no good (only a ushort, that means less than 2^16 => at best 512MB)
- my $total = c::total_sectors(fileno F);
- $geom{totalcylinders} = $total / $geom{heads} * $geom{sectors};
+ if (my $total = c::total_sectors(fileno F)) {
+ $geom{cylinders} = $total / $geom{heads} / $geom{sectors};
+ }
- { geom => \%geom, totalsectors => $total };
+ { geom => \%geom, totalsectors => $geom{heads} * $geom{sectors} * $geom{cylinders} };
}
sub openit($$;$) { sysopen $_[1], $_[0]{file}, $_[2] || 0; }