diff options
Diffstat (limited to 'ufs-fsck')
-rw-r--r-- | ufs-fsck/ChangeLog | 5 | ||||
-rw-r--r-- | ufs-fsck/pass2.c | 24 |
2 files changed, 29 insertions, 0 deletions
diff --git a/ufs-fsck/ChangeLog b/ufs-fsck/ChangeLog index 1ea09c4a..cebead0c 100644 --- a/ufs-fsck/ChangeLog +++ b/ufs-fsck/ChangeLog @@ -1,3 +1,8 @@ +Thu Jul 18 14:55:14 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> + + * pass2.c (pass2): If an entire directory block is null, allow + preen to patch it into a normal empty directory entry. + Sat Jul 6 19:59:27 1996 Miles Bader <miles@gnu.ai.mit.edu> * main.c (argp_program_version): New variable. diff --git a/ufs-fsck/pass2.c b/ufs-fsck/pass2.c index 69331946..db63abd7 100644 --- a/ufs-fsck/pass2.c +++ b/ufs-fsck/pass2.c @@ -60,6 +60,30 @@ pass2 () if (dp->d_reclen == 0 || dp->d_reclen + (void *)dp - buf > DIRBLKSIZ) { + /* Perhaps the entire dir block is zero. UFS does that + when extending directories. So allow preening + to safely patch up all-null dir blocks. */ + if (dp == buf) + { + char *bp; + for (bp = (char *)buf; bp < (char *)buf + DIRBLKSIZ; bp++) + if (*bp) + goto reclen_problem; + + problem (0, "NULL BLOCK IN DIRECTORY"); + if (preen || reply ("PATCH")) + { + /* Mark this entry free, and return. */ + dp->d_ino = 0; + dp->d_reclen = DIRBLKSIZ; + pfix ("PATCHED"); + return 1; + } + else + return mod; + } + + reclen_problem: problem (1, "BAD RECLEN IN DIRECTORY"); if (reply ("SALVAGE")) { |