From 37af479ddeb125d701a31c4f4f3ed75909a5899b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 14 Sep 2001 23:27:24 +0000 Subject: when testing for bad drives, if opening for writing fails, remove the drive from the hard drive list (useful for Smartmedia readers) --- perl-install/install_any.pm | 4 +++- perl-install/partition_table_raw.pm | 5 ++++- 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; -- cgit v1.2.1