summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-09-14 23:27:24 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-09-14 23:27:24 +0000
commit37af479ddeb125d701a31c4f4f3ed75909a5899b (patch)
treed4e2348dedb66f6b364528ce9020379dd402a90a
parent0e7c847a2d04982bd8d04c96961a9eee86c01ac6 (diff)
downloaddrakx-37af479ddeb125d701a31c4f4f3ed75909a5899b.tar
drakx-37af479ddeb125d701a31c4f4f3ed75909a5899b.tar.gz
drakx-37af479ddeb125d701a31c4f4f3ed75909a5899b.tar.bz2
drakx-37af479ddeb125d701a31c4f4f3ed75909a5899b.tar.xz
drakx-37af479ddeb125d701a31c4f4f3ed75909a5899b.zip
when testing for bad drives, if opening for writing fails, remove the drive from the hard drive list (useful for Smartmedia readers)
-rw-r--r--perl-install/install_any.pm4
-rw-r--r--perl-install/partition_table_raw.pm5
2 files changed, 7 insertions, 2 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index fbea1410b..a82ebe5b9 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -948,7 +948,9 @@ sub getHds {
$o->setupSCSI; #- ask for an unautodetected scsi card
goto getHds;
}
- $::testing or partition_table_raw::test_for_bad_drives($_) foreach @$hds;
+ if (!$::testing) {
+ @$hds = grep { partition_table_raw::test_for_bad_drives($_) } @$hds;
+ }
$ok = fsedit::verifyHds($hds, $flags->{readonly}, $ok)
if !($flags->{clearall} || $flags->{clear});
diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm
index 733970a4e..5a5f27f1b 100644
--- a/perl-install/partition_table_raw.pm
+++ b/perl-install/partition_table_raw.pm
@@ -129,6 +129,8 @@ sub zero_MBR_and_dirty {
#- ugly stuff needed mainly for Western Digital IDE drives
#- try writing what we've just read, yells if it fails
#- testing on last sector of head #0 (unused in 99% cases)
+#-
+#- return false if the device can't be written to (especially for Smartmedia)
sub test_for_bad_drives {
my ($hd) = @_;
@@ -136,7 +138,7 @@ sub test_for_bad_drives {
my $sector = $hd->{geom}{sectors} - 1;
- local *F; openit($hd, *F, 2) or die "error opening device $hd->{device} for writing";
+ local *F; openit($hd, *F, 2) or return;
my $seek = sub {
c::lseek_sector(fileno(F), $sector, 0) or die "seeking to sector $sector failed";
@@ -152,6 +154,7 @@ sub test_for_bad_drives {
_("Something bad is happening on your drive.
A test to check the integrity of data has failed.
It means writing anything on the disk will end up with random trash");
+ 1;
}
1;