Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fsck_ffs Fix an evil ugly bug which causes files placed...



details:   https://anonhg.NetBSD.org/src/rev/6d971307cdc9
branches:  trunk
changeset: 495723:6d971307cdc9
user:      castor <castor%NetBSD.org@localhost>
date:      Thu Aug 03 14:52:39 2000 +0000

description:
Fix an evil ugly bug which causes files placed into lost+found to
be inconsistent, and unremovable. From Ethan Solomita <ethan%geocast.com@localhost>.
Reviewed by fvdl.

diffstat:

 sbin/fsck_ffs/dir.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (49 lines):

diff -r b50e7a6b87be -r 6d971307cdc9 sbin/fsck_ffs/dir.c
--- a/sbin/fsck_ffs/dir.c       Thu Aug 03 14:31:04 2000 +0000
+++ b/sbin/fsck_ffs/dir.c       Thu Aug 03 14:52:39 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.26 1999/11/15 19:18:24 fvdl Exp $    */
+/*     $NetBSD: dir.c,v 1.27 2000/08/03 14:52:39 castor Exp $  */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)dir.c      8.8 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: dir.c,v 1.26 1999/11/15 19:18:24 fvdl Exp $");
+__RCSID("$NetBSD: dir.c,v 1.27 2000/08/03 14:52:39 castor Exp $");
 #endif
 #endif /* not lint */
 
@@ -94,6 +94,13 @@
        inpend = &inpsort[inplast];
        for (inpp = inpsort; inpp < inpend; inpp++) {
                inp = *inpp;
+               inp->i_child = inp->i_sibling = inp->i_parentp = 0;
+               if (statemap[inp->i_number] == DFOUND)
+                       statemap[inp->i_number] = DSTATE;
+       }
+
+       for (inpp = inpsort; inpp < inpend; inpp++) {
+               inp = *inpp;
                if (inp->i_parent == 0 ||
                    inp->i_number == ROOTINO)
                        continue;
@@ -687,6 +694,7 @@
        ino_t parent, request;
        int mode;
 {
+       struct inoinfo *inp;
        ino_t ino;
        char *cp;
        struct dinode *dp;
@@ -731,6 +739,8 @@
                return (0);
        }
        cacheino(dp, ino);
+       inp = getinoinfo(ino);
+       inp->i_parent = inp->i_dotdot = parent;
        statemap[ino] = statemap[parent];
        if (statemap[ino] == DSTATE) {
                lncntp[ino] = iswap16(dp->di_nlink);



Home | Main Index | Thread Index | Old Index