"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mbadblocks.c" between
mtools-4.0.35.tar.bz2 and mtools-4.0.36.tar.bz2

About: Mtools is a collection of utilities to access MS-DOS disks from Unix without mounting them.

mbadblocks.c  (mtools-4.0.35.tar.bz2):mbadblocks.c  (mtools-4.0.36.tar.bz2)
skipping to change at line 86 skipping to change at line 86
off_t ret; off_t ret;
mt_off_t pos; mt_off_t pos;
int bad=0; int bad=0;
if(Fs->fat_decode((Fs_t*)Fs, cluster)) if(Fs->fat_decode((Fs_t*)Fs, cluster))
/* cluster busy, or already marked */ /* cluster busy, or already marked */
return 0; return 0;
start = (cluster - 2) * Fs->cluster_size + Fs->clus_start; start = (cluster - 2) * Fs->cluster_size + Fs->clus_start;
pos = sectorsToBytes(Fs, start); pos = sectorsToBytes(Fs, start);
if(doWrite) { if(doWrite) {
ret = force_write(dev, buffer, pos, in_len); ret = force_pwrite(dev, buffer, pos, in_len);
if(ret < 0 || (size_t) ret < in_len ) if(ret < 0 || (size_t) ret < in_len )
bad = 1; bad = 1;
} else { } else {
ret = force_read(dev, in_buf, pos, in_len); ret = force_pread(dev, in_buf, pos, in_len);
if(ret < (off_t) in_len ) if(ret < (off_t) in_len )
bad = 1; bad = 1;
else if(buffer) { else if(buffer) {
size_t i; size_t i;
for(i=0; i<in_len; i++) for(i=0; i<in_len; i++)
if(in_buf[i] != buffer[i]) { if(in_buf[i] != buffer[i]) {
bad = 1; bad = 1;
break; break;
} }
} }
skipping to change at line 192 skipping to change at line 192
ret = 1; ret = 1;
goto exit_0; goto exit_0;
} }
init_random(); init_random();
for(i=0; i < in_len * N_PATTERN; i++) { for(i=0; i < in_len * N_PATTERN; i++) {
pat_buf[i] = (char) random(); pat_buf[i] = (char) random();
} }
} }
for(i=0; i < Fs->clus_start; i++ ){ for(i=0; i < Fs->clus_start; i++ ){
ssize_t r; ssize_t r;
r = READS(Fs->Next, in_buf, r = PREADS(Fs->head.Next, in_buf,
sectorsToBytes(Fs, i), Fs->sector_size); sectorsToBytes(Fs, i), Fs->sector_size);
if( r < 0 ){ if( r < 0 ){
perror("early error"); perror("early error");
ret = -1; ret = -1;
goto exit_0; goto exit_0;
} }
if((size_t) r < Fs->sector_size){ if((size_t) r < Fs->sector_size){
fprintf(stderr,"end of file in file_read\n"); fprintf(stderr,"end of file in file_read\n");
ret = 1; ret = 1;
goto exit_0; goto exit_0;
} }
skipping to change at line 240 skipping to change at line 240
fprintf(stderr, "Sector before start\n"); fprintf(stderr, "Sector before start\n");
} else if(offset >= Fs->num_clus) { } else if(offset >= Fs->num_clus) {
fprintf(stderr, "Sector beyond end\n"); fprintf(stderr, "Sector beyond end\n");
} else { } else {
mark(Fs, offset, badClus); mark(Fs, offset, badClus);
ret = 1; ret = 1;
} }
} }
} else { } else {
Stream_t *dev; Stream_t *dev;
dev = Fs->Next; dev = Fs->head.Next;
if(dev->Next) if(dev->Next)
dev = dev->Next; dev = dev->Next;
in_len = Fs->cluster_size * Fs->sector_size; in_len = Fs->cluster_size * Fs->sector_size;
if(writeMode) { if(writeMode) {
/* Write pattern */ /* Write pattern */
for(i=startSector; i< endSector; i++){ for(i=startSector; i< endSector; i++){
if(got_signal) if(got_signal)
break; break;
progress(i, Fs->num_clus); progress(i, Fs->num_clus);
 End of changes. 4 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)