bostic@OKEEFFE.BERKELEY.EDU.UUCP (06/18/87)
Subject: bad144 can incorrectly mark bad blocks
Index: etc/bad144.c 4.3BSD
Description:
When using the -f option, if bad144 is unable to read the header
of a block that it is trying to mark as bad, the block is marked
as good.
Fix:
The fix was to reverse the order of when the bad sector information
is written. Apply the following patch.
*** bad144.c.old Thu Jun 18 11:41:53 1987
--- bad144.c.new Thu Jun 18 11:44:49 1987
***************
*** 540,553 ****
Perror("ioctl");
if ((n = read(fd, buf, fp->f_bufsize)) < 0)
bzero(buf, fp->f_bufsize);
if (fp->f_bic) {
struct hpuphdr *xp = (struct hpuphdr *)buf;
xp->hpup_cyl &= ~fp->f_bic;
}
- if (fp->f_routine)
- if ((*fp->f_routine)(fp, dp, blk, buf, n) != 0)
- return;
if (lseek(fd, (long)blk * dp->d_secsize, L_SET) < 0)
Perror("lseek");
if (nflag)
--- 540,553 ----
Perror("ioctl");
if ((n = read(fd, buf, fp->f_bufsize)) < 0)
bzero(buf, fp->f_bufsize);
+ if (fp->f_routine)
+ if ((*fp->f_routine)(fp, dp, blk, buf, n) != 0)
+ return;
if (fp->f_bic) {
struct hpuphdr *xp = (struct hpuphdr *)buf;
xp->hpup_cyl &= ~fp->f_bic;
}
if (lseek(fd, (long)blk * dp->d_secsize, L_SET) < 0)
Perror("lseek");
if (nflag)