]> git.wh0rd.org - dump.git/commitdiff
Bug when dumping a previouslly mapped deleted and not reallocated directory inode.
authorStelian Pop <stelian@popies.net>
Tue, 25 Jan 2000 14:14:12 +0000 (14:14 +0000)
committerStelian Pop <stelian@popies.net>
Tue, 25 Jan 2000 14:14:12 +0000 (14:14 +0000)
CHANGES
dump/main.c

diff --git a/CHANGES b/CHANGES
index 77420a68073830edb89d06dca62d04bc374cad28..f83917dc9c63620039863c038a05b37d5805defa 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,14 @@
-$Id: CHANGES,v 1.36 2000/01/21 10:33:40 stelian Exp $
+$Id: CHANGES,v 1.37 2000/01/25 14:14:12 stelian Exp $
+
+Changes between versions 0.4b13 and 0.4b14 (released ????????????????)
+======================================================================
+
+1.     Fixed a bug in dump which may have caused invalid deleted 
+       directories to be dumped out if they were deleted after the
+       mapping pass. This could occure on active filesystem and lead
+       to heap corruption (causing dump malfunction in many possible ways).
+       Thanks to Jan Sanislo <oystr@cs.washington.edu> for finding this
+       bug and submitting the patch.
 
 Changes between versions 0.4b12 and 0.4b13 (released January 21, 2000)
 ======================================================================
index 20562bbc17c71ff7329a56174d208c8711930049..cc1ed919ab0109739920748656d33f87520f9683 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.12 2000/01/21 10:17:41 stelian Exp $";
+       "$Id: main.c,v 1.13 2000/01/25 14:14:12 stelian Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -595,6 +595,11 @@ main(int argc, char *argv[])
                if ((dp->di_mode & IFMT) != IFDIR)
                        continue;
 #ifdef __linux__
+               /*
+                * Skip directory inodes deleted and not yes reallocated...
+                */
+               if (dp->di_nlink == 0 || dp->di_dtime != 0)
+                       continue;
                (void)dumpdirino(dp, ino);
 #else
                (void)dumpino(dp, ino);
@@ -603,8 +608,6 @@ main(int argc, char *argv[])
 
        msg("dumping (Pass IV) [regular files]\n");
        for (map = dumpinomap, ino = 1; ino < maxino; ino++) {
-               int mode;
-
                if (((ino - 1) % NBBY) == 0)    /* map is offset by 1 */
                        dirty = *map++;
                else
@@ -615,9 +618,14 @@ main(int argc, char *argv[])
                 * Skip inodes deleted and reallocated as directories.
                 */
                dp = getino(ino);
-               mode = dp->di_mode & IFMT;
-               if (mode == IFDIR)
+               if ((dp->di_mode & IFMT) == IFDIR)
                        continue;
+#ifdef __linux__
+               /*
+                * No need to check here for deleted and not yes reallocated inodes
+                * since this is done in dumpino().
+                */
+#endif
                (void)dumpino(dp, ino);
        }