summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-09-29 03:26:38 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-09-29 03:26:38 +0000
commit4bbec5f4c46fee4ad7160edd35a486c10d90be42 (patch)
tree9c426708e5a1e1e98d613244ff5fee60ce7a44a5
parentc36ea7f3d6b5195c92633a975b28bd642f996ad9 (diff)
downloaddrakx-backup-do-not-use-4bbec5f4c46fee4ad7160edd35a486c10d90be42.tar
drakx-backup-do-not-use-4bbec5f4c46fee4ad7160edd35a486c10d90be42.tar.gz
drakx-backup-do-not-use-4bbec5f4c46fee4ad7160edd35a486c10d90be42.tar.bz2
drakx-backup-do-not-use-4bbec5f4c46fee4ad7160edd35a486c10d90be42.tar.xz
drakx-backup-do-not-use-4bbec5f4c46fee4ad7160edd35a486c10d90be42.zip
don't die when failing to open a device (to get its geometry), skip it instead
(as used to be done before partition_table::raw::get_geometries() was introduced)
-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 {