]> git.wh0rd.org - dump.git/blobdiff - dump/main.c
Bug when dumping a previouslly mapped deleted and not reallocated directory inode.
[dump.git] / dump / main.c
index 3c56b84cfb43a82330b7539c445d873b393cef8c..cc1ed919ab0109739920748656d33f87520f9683 100644 (file)
@@ -2,7 +2,7 @@
  *     Ported to Linux's Second Extended File System as part of the
  *     dump and restore backup suit
  *     Remy Card <card@Linux.EU.Org>, 1994-1997
- *     Stelian Pop <pop@cybercable.fr>, 1999 
+ *     Stelian Pop <pop@cybercable.fr>, 1999-2000
  */
 
 /*-
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.10 1999/12/17 10:14:59 tiniou Exp $";
+       "$Id: main.c,v 1.13 2000/01/25 14:14:12 stelian Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -514,7 +514,7 @@ main(int argc, char *argv[])
        }
 
        if (sizest) {
-               printf("%ld\n", tapesize + 10);
+               printf("%.0f\n", ((double)tapesize + 10) * TP_BSIZE);
                exit(X_FINOK);
        } /* stop here for size estimate */
 
@@ -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);
        }