summaryrefslogtreecommitdiff
path: root/sbin/fsck_ffs/pass3.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/fsck_ffs/pass3.c')
-rw-r--r--sbin/fsck_ffs/pass3.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sbin/fsck_ffs/pass3.c b/sbin/fsck_ffs/pass3.c
index 2c7903649ae..eb4ecbd728e 100644
--- a/sbin/fsck_ffs/pass3.c
+++ b/sbin/fsck_ffs/pass3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass3.c,v 1.3 1999/03/01 07:45:18 d Exp $ */
+/* $OpenBSD: pass3.c,v 1.4 2001/05/28 21:22:47 gluk Exp $ */
/* $NetBSD: pass3.c,v 1.8 1995/03/18 14:55:54 cgd Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pass3.c 8.1 (Berkeley) 6/5/93";
#else
-static char rcsid[] = "$OpenBSD: pass3.c,v 1.3 1999/03/01 07:45:18 d Exp $";
+static char rcsid[] = "$OpenBSD: pass3.c,v 1.4 2001/05/28 21:22:47 gluk Exp $";
#endif
#endif /* not lint */
@@ -64,7 +64,7 @@ pass3_info(buf, buflen)
void
pass3()
{
- register struct inoinfo **inpp, *inp;
+ register struct inoinfo **inpp, *inp, *pinp;
ino_t orphan;
int loopcnt;
@@ -73,7 +73,7 @@ pass3()
info_pos++;
inp = *inpp;
if (inp->i_number == ROOTINO ||
- !(inp->i_parent == 0 || statemap[inp->i_number] == DSTATE))
+ (inp->i_parent != 0 && statemap[inp->i_number] != DSTATE))
continue;
if (statemap[inp->i_number] == DCLEAR)
continue;
@@ -85,11 +85,16 @@ pass3()
break;
inp = getinoinfo(inp->i_parent);
}
- (void)linkup(orphan, inp->i_dotdot);
- inp->i_parent = inp->i_dotdot = lfdir;
- lncntp[lfdir]--;
- statemap[orphan] = DFOUND;
- propagate();
+ if (linkup(orphan, inp->i_dotdot)) {
+ inp->i_parent = inp->i_dotdot = lfdir;
+ lncntp[lfdir]--;
+ pinp = getinoinfo(inp->i_parent);
+ inp->i_parentp = pinp;
+ inp->i_sibling = pinp->i_child;
+ pinp->i_child = inp;
+ statemap[orphan] = statemap[inp->i_parent];
+ }
+ propagate(orphan);
}
info_fn = NULL;
}