summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/partition_table.pm16
-rw-r--r--perl-install/partition_table/raw.pm11
2 files changed, 17 insertions, 10 deletions
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index e9c192e09..35ba8550b 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -235,7 +235,7 @@ sub read_primary {
);
foreach ('empty', @parttype, 'unknown') {
/unknown/ and die "unknown partition table format on disk " . $hd->{file};
- eval {
+
# perl_checker: require partition_table::bsd
# perl_checker: require partition_table::dos
# perl_checker: require partition_table::empty
@@ -244,16 +244,12 @@ sub read_primary {
# perl_checker: require partition_table::sun
require "partition_table/$_.pm";
bless $hd, "partition_table::$_";
- ($pt, $info) = $hd->read_one(0);
- log::l("found a $_ partition table on $hd->{file} at sector 0");
- };
- $@ or last;
+ if ($hd->read_primary) {
+ log::l("found a $_ partition table on $hd->{file} at sector 0");
+ return 1;
+ }
}
- my $primary = partition_table::raw::pt_info_to_primary($hd, $pt, $info) or return;
- $hd->{primary} = $primary;
- undef $hd->{extended};
- verifyPrimary($primary);
- 1;
+ 0;
}
sub read {
diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm
index e2fd7e949..c3138a54a 100644
--- a/perl-install/partition_table/raw.pm
+++ b/perl-install/partition_table/raw.pm
@@ -236,6 +236,17 @@ sub zero_MBR_and_dirty {
zero_MBR($hd);
}
+sub read_primary {
+ my ($hd) = @_;
+
+ my ($pt, $info) = eval { $hd->read_one(0) } or return;
+ my $primary = partition_table::raw::pt_info_to_primary($hd, $pt, $info);
+ $hd->{primary} = $primary;
+ undef $hd->{extended};
+ partition_table::verifyPrimary($primary);
+ 1;
+}
+
sub pt_info_to_primary {
my ($hd, $pt, $info) = @_;