diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-09-29 03:26:38 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-09-29 03:26:38 +0000 |
commit | 4bbec5f4c46fee4ad7160edd35a486c10d90be42 (patch) | |
tree | 9c426708e5a1e1e98d613244ff5fee60ce7a44a5 /perl-install/partition_table/raw.pm | |
parent | c36ea7f3d6b5195c92633a975b28bd642f996ad9 (diff) | |
download | drakx-4bbec5f4c46fee4ad7160edd35a486c10d90be42.tar drakx-4bbec5f4c46fee4ad7160edd35a486c10d90be42.tar.gz drakx-4bbec5f4c46fee4ad7160edd35a486c10d90be42.tar.bz2 drakx-4bbec5f4c46fee4ad7160edd35a486c10d90be42.tar.xz drakx-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)
Diffstat (limited to 'perl-install/partition_table/raw.pm')
-rw-r--r-- | perl-install/partition_table/raw.pm | 23 |
1 files changed, 15 insertions, 8 deletions
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 { |