diff options
author | Michael I. Bushnell <mib@gnu.org> | 1994-10-25 15:50:51 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1994-10-25 15:50:51 +0000 |
commit | 7843a2ecd03eb2fad0d4e2ed6bad695bae4fd7b2 (patch) | |
tree | 8e0d055e9b58654cd747d532ea00a497438253cb | |
parent | 7f9033632b20aa8b0fd17dca3cbf74a52b6b287e (diff) |
Formerly pass2.c.~10~
-rw-r--r-- | ufs-fsck/pass2.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/ufs-fsck/pass2.c b/ufs-fsck/pass2.c index a04b475e..e300501a 100644 --- a/ufs-fsck/pass2.c +++ b/ufs-fsck/pass2.c @@ -163,14 +163,36 @@ pass2 () /* Account for the inode in the linkfound map */ if (inodestate[dp->d_ino] != UNALLOC) linkfound[dp->d_ino]++; - - /* If this is `.' or `..' then note the value for - later examination. */ - if (dp->d_namlen == 1 && dp->d_name[0] == '.') - dnp->i_dot = dp->d_ino; - if (dp->d_namlen == 2 - && dp->d_name[0] == '.' && dp->d_name[1] == '.') - dnp->i_dotdot = dp->d_ino; + + if (inodestate[dp->d_ino] == DIRECTORY + || inodestate[dp->d_ino] == BADDIR) + { + if (dp->d_namlen == 1 && dp->d_name[0] == '.') + dnp->i_dot = dp->d_ino; + else if (dp->d_namlen == 2 + && dp->d_name[0] == '.' && dp->d_name[1] == '.') + dnp->i_dotdot = dp->d_ino; + else + { + struct dirinfo *targetdir; + targetdir = lookup_directory (dp->d_ino); + if (targetdir->i_parent) + { + printf ("EXTRANEOUS LINK %s TO DIR I=%ld", dp->d_name, + dp->d_ino); + pwarn ("FOUND IN DIR I=%d", dnp->i_number); + if (preen || reply ("REMOVE")) + { + if (preen) + printf (" (REMOVED)"); + dp->d_ino = 0; + mod = 1; + } + } + else + targetdir->i_parent = dnp->i_number; + } + } } return mod; } |