summaryrefslogtreecommitdiff
path: root/sbin/fsck_ffs/pass2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/fsck_ffs/pass2.c')
-rw-r--r--sbin/fsck_ffs/pass2.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c
index de08a8c5fd3..69fced5af54 100644
--- a/sbin/fsck_ffs/pass2.c
+++ b/sbin/fsck_ffs/pass2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass2.c,v 1.7 1999/03/01 07:45:18 d Exp $ */
+/* $OpenBSD: pass2.c,v 1.8 2001/03/02 08:33:55 art Exp $ */
/* $NetBSD: pass2.c,v 1.17 1996/09/27 22:45:15 christos Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pass2.c 8.6 (Berkeley) 10/27/94";
#else
-static char rcsid[] = "$OpenBSD: pass2.c,v 1.7 1999/03/01 07:45:18 d Exp $";
+static char rcsid[] = "$OpenBSD: pass2.c,v 1.8 2001/03/02 08:33:55 art Exp $";
#endif
#endif /* not lint */
@@ -96,8 +96,10 @@ pass2()
case USTATE:
pfatal("ROOT INODE UNALLOCATED");
- if (reply("ALLOCATE") == 0)
+ if (reply("ALLOCATE") == 0) {
+ ckfini(0);
errexit("%s", "");
+ }
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
break;
@@ -110,8 +112,10 @@ pass2()
errexit("CANNOT ALLOCATE ROOT INODE\n");
break;
}
- if (reply("CONTINUE") == 0)
+ if (reply("CONTINUE") == 0) {
+ ckfini(0);
errexit("%s", "");
+ }
break;
case FSTATE:
@@ -123,8 +127,10 @@ pass2()
errexit("CANNOT ALLOCATE ROOT INODE\n");
break;
}
- if (reply("FIX") == 0)
+ if (reply("FIX") == 0) {
+ ckfini(0);
errexit("%s", "");
+ }
dp = ginode(ROOTINO);
dp->di_mode &= ~IFMT;
dp->di_mode |= IFDIR;
@@ -170,8 +176,14 @@ pass2()
}
} else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) {
getpathname(pathbuf, inp->i_number, inp->i_number);
- pwarn("DIRECTORY %s: LENGTH %d NOT MULTIPLE OF %d",
- pathbuf, inp->i_isize, DIRBLKSIZ);
+ if (usedsoftdep)
+ pfatal("%s %s: LENGTH %d NOT MULTIPLE of %d",
+ "DIRECTORY", pathbuf, inp->i_isize,
+ DIRBLKSIZ);
+ else
+ pwarn("%s %s: LENGTH %d NOT MULTIPLE OF %d",
+ "DIRECTORY", pathbuf, inp->i_isize,
+ DIRBLKSIZ);
if (preen)
printf(" (ADJUSTED)\n");
inp->i_isize = roundup(inp->i_isize, DIRBLKSIZ);
@@ -425,7 +437,7 @@ again:
break;
if (statemap[dirp->d_ino] == FCLEAR)
errmsg = "DUP/BAD";
- else if (!preen)
+ else if (!preen && !usedsoftdep)
errmsg = "ZERO LENGTH DIRECTORY";
else {
n = 1;
@@ -450,8 +462,11 @@ again:
pwarn("%s %s %s\n", pathbuf,
"IS AN EXTRANEOUS HARD LINK TO DIRECTORY",
namebuf);
- if (preen)
- printf(" (IGNORED)\n");
+ if (preen) {
+ printf (" (REMOVED)\n");
+ n = 1;
+ break;
+ }
else if ((n = reply("REMOVE")) == 1)
break;
}