summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/fsedit.pm2
-rw-r--r--perl-install/partition_table/raw.pm23
2 files changed, 16 insertions, 9 deletions
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index c3d46d332..42404bfe8 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -109,7 +109,7 @@ sub get_hds {
$hd->{prefix} ||= $hd->{device};
}
- partition_table::raw::get_geometries(\@drives);
+ @drives = partition_table::raw::get_geometries(@drives);
my (@hds, @raw_hds);
foreach my $hd (@drives) {
diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm
index 59ca08906..4ed615b2a 100644
--- a/perl-install/partition_table/raw.pm
+++ b/perl-install/partition_table/raw.pm
@@ -101,22 +101,27 @@ sub keep_non_duplicates {
}
sub get_geometries {
- my ($hds) = @_;
+ my (@hds) = @_;
- foreach my $hd (@$hds) {
- my $h = get_geometry($hd->{file}) or log::l("An error occurred while getting the geometry of block device $hd->{file}: $!"), next;
- add2hash_($hd, $h);
- }
+ @hds = grep {
+ if (my $h = get_geometry($_->{file})) {
+ add2hash_($_, $h);
+ 1;
+ } else {
+ log::l("An error occurred while getting the geometry of block device $_->{file}: $!");
+ 0;
+ }
+ } @hds;
my %id2hd = keep_non_duplicates(map {
- my $F = openit($_) or die "failed to open device $_->{device}";
+ my $F = openit($_) or log::l("failed to open device $_->{device}");
my $tmp;
- if (c::lseek_sector(fileno($F), 0, 0x1b8) && sysread($F, $tmp, 4)) {
+ if ($F && c::lseek_sector(fileno($F), 0, 0x1b8) && sysread($F, $tmp, 4)) {
[ sprintf('0x%08x', unpack('V', $tmp)), $_ ];
} else {
();
}
- } @$hds);
+ } @hds);
my %id2edd = keep_non_duplicates(map { [ chomp_(cat_("$_/mbr_signature")), $_ ] } glob("/sys/firmware/edd/int13_dev*"));
@@ -136,6 +141,8 @@ sub get_geometries {
$hd->{geom} = $geom if $geom;
}
}
+
+ @hds;
}
sub get_geometry {