summaryrefslogtreecommitdiff
path: root/ufs-fsck/pass2.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-07-18 19:11:03 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-07-18 19:11:03 +0000
commit1a15cb8ff36fe1f23d927e43b5653ab68a1bfa7f (patch)
tree6c17febe937e0e8cb0baac69e472863391b9bcc3 /ufs-fsck/pass2.c
parentbe1fc488e93349d92fb30b1b4deb58fc2b118d56 (diff)
*** empty log message ***
Diffstat (limited to 'ufs-fsck/pass2.c')
-rw-r--r--ufs-fsck/pass2.c24
1 files changed, 24 insertions, 0 deletions
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"))
{