Warn about bad sectors if pure disk I/O fails with EIO. This is regularly

reported with faulty disks.
edge.strict_endians
szaka 2006-04-18 22:03:09 +00:00
parent b594b42db5
commit 00348fc7f5
1 changed files with 12 additions and 4 deletions

View File

@ -1420,13 +1420,21 @@ static void copy_clusters(ntfs_resize_t *resize, s64 dest, s64 src, s64 len)
lseek_to_cluster(vol, src + i);
if (read_all(vol->dev, buff, vol->cluster_size) == -1)
perr_exit("read_all");
if (read_all(vol->dev, buff, vol->cluster_size) == -1) {
perr_printf("Failed to read from the disk");
if (errno == EIO)
printf("%s", bad_sectors_warning_msg);
exit(1);
}
lseek_to_cluster(vol, dest + i);
if (write_all(vol->dev, buff, vol->cluster_size) == -1)
perr_exit("write_all");
if (write_all(vol->dev, buff, vol->cluster_size) == -1) {
perr_printf("Failed to write to the disk");
if (errno == EIO)
printf("%s", bad_sectors_warning_msg);
exit(1);
}
resize->relocations++;
progress_update(&resize->progress, resize->relocations);