summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mandriva.org>2009-08-04 15:59:18 +0000
committerPascal Terjan <pterjan@mandriva.org>2009-08-04 15:59:18 +0000
commitaa39c4c2690ea3edd7ccdff9148eb0357608d5b2 (patch)
tree9fbfa4ecec3b139f2ab166ce2a1ede0cd72e68b3 /perl-install/partition_table
parent6dba43e70059bcad74dd66cfc1ba0d6f274ca0c7 (diff)
downloaddrakx-backup-do-not-use-aa39c4c2690ea3edd7ccdff9148eb0357608d5b2.tar
drakx-backup-do-not-use-aa39c4c2690ea3edd7ccdff9148eb0357608d5b2.tar.gz
drakx-backup-do-not-use-aa39c4c2690ea3edd7ccdff9148eb0357608d5b2.tar.bz2
drakx-backup-do-not-use-aa39c4c2690ea3edd7ccdff9148eb0357608d5b2.tar.xz
drakx-backup-do-not-use-aa39c4c2690ea3edd7ccdff9148eb0357608d5b2.zip
Fix a crash when trying to create a partition on a device with no cylinder_size
Diffstat (limited to 'perl-install/partition_table')
-rw-r--r--perl-install/partition_table/raw.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm
index 0a878107c..739e1f384 100644
--- a/perl-install/partition_table/raw.pm
+++ b/perl-install/partition_table/raw.pm
@@ -79,11 +79,13 @@ sub adjustStart($$) {
my ($hd, $part) = @_;
my $end = $part->{start} + $part->{size};
- $part->{start} = round_up($part->{start},
- $part->{start} % cylinder_size($hd) < 2 * $hd->{geom}{sectors} ?
- $hd->{geom}{sectors} : cylinder_size($hd));
- $part->{size} = $end - $part->{start};
- $part->{size} > 0 or die "adjustStart get a too small partition to handle correctly";
+ if(cylinder_size($hd)) {
+ $part->{start} = round_up($part->{start},
+ $part->{start} % cylinder_size($hd) < 2 * $hd->{geom}{sectors} ?
+ $hd->{geom}{sectors} : cylinder_size($hd));
+ $part->{size} = $end - $part->{start};
+ $part->{size} > 0 or die "adjustStart get a too small partition to handle correctly";
+ }
}
#- adjusting end to match a cylinder boundary, two methods are used and must
#- match at the end, else something is wrong and nothing will be done on