summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-08-27 22:03:59 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-08-27 22:03:59 +0000
commit01868d6bc05f8af773b5d4d50542b372a99ff528 (patch)
tree715e6f4bcb542463ad2579c75dc10ed24e977828
parentf4b8b2cb9091dd4415a5e6a361408d8209e264ac (diff)
downloaddrakx-01868d6bc05f8af773b5d4d50542b372a99ff528.tar
drakx-01868d6bc05f8af773b5d4d50542b372a99ff528.tar.gz
drakx-01868d6bc05f8af773b5d4d50542b372a99ff528.tar.bz2
drakx-01868d6bc05f8af773b5d4d50542b372a99ff528.tar.xz
drakx-01868d6bc05f8af773b5d4d50542b372a99ff528.zip
(test_for_bad_drives): classify error messages (either read, write or something-else)
-rw-r--r--perl-install/partition_table/raw.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm
index 37208d230..89a89cffd 100644
--- a/perl-install/partition_table/raw.pm
+++ b/perl-install/partition_table/raw.pm
@@ -170,16 +170,18 @@ sub test_for_bad_drives {
log::l("test_for_bad_drives($hd->{file})");
my $sector = $hd->{geom}{sectors} - 1;
+ sub error { die "$_[0] error: $_[1]" }
- local *F; openit($hd, *F, 2) or die "can't open device";
+ local *F; openit($hd, *F, 2) or error(openit($hd, *F, 0) ? 'write' : 'read', "can't open device");
my $seek = sub {
- c::lseek_sector(fileno(F), $sector, 0) or die "seeking to sector $sector failed";
+ c::lseek_sector(fileno(F), $sector, 0) or error('read', "seeking to sector $sector failed");
};
my $tmp;
- &$seek; sysread F, $tmp, $SECTORSIZE or die "test_for_bad_drives: can't even read ($!)";
- &$seek; syswrite F, $tmp or die "test_for_bad_drives: can't even write ($!)";
+ &$seek; sysread F, $tmp, $SECTORSIZE or error('read', "can't even read ($!)");
+ return if $hd->{readonly} || $::testing;
+ &$seek; syswrite F, $tmp or error('write', "can't even write ($!)");
my $tmp2;
&$seek; sysread F, $tmp2, $SECTORSIZE or die "test_for_bad_drives: can't even read again ($!)";
@@ -187,7 +189,6 @@ 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;