]> git.wh0rd.org - dump.git/commitdiff
Fix maps overflow in restore when doing incremental restores (and MAXINO becomes...
authorStelian Pop <stelian@popies.net>
Fri, 15 Nov 2002 09:25:25 +0000 (09:25 +0000)
committerStelian Pop <stelian@popies.net>
Fri, 15 Nov 2002 09:25:25 +0000 (09:25 +0000)
CHANGES
THANKS
restore/extern.h
restore/main.c
restore/symtab.c
restore/tape.c
restore/utilities.c

diff --git a/CHANGES b/CHANGES
index e6dd0f75b1165d97e9f0b802c151fa2c858e48f4..7d5273e54ed134e0693285323f927ac073a50a00 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.196 2002/10/07 19:27:35 stelian Exp $
+$Id: CHANGES,v 1.197 2002/11/15 09:25:25 stelian Exp $
 
 Changes between versions 0.4b31 and 0.4b32 (released ?????????????)
 ===================================================================
 
 Changes between versions 0.4b31 and 0.4b32 (released ?????????????)
 ===================================================================
@@ -29,6 +29,12 @@ Changes between versions 0.4b31 and 0.4b32 (released ?????????????)
        of whitespace. Thanks to Jeffrey Sofferin 
        <sofferin@users.sourceforge.net> for reporting this bug.
 
        of whitespace. Thanks to Jeffrey Sofferin 
        <sofferin@users.sourceforge.net> for reporting this bug.
 
+6.     Fixed a bug which caused restore, in some particular cases,
+       to ask some 'scary' questions and leave a bunch of RSTTMP
+       directories behind when restoring incremental tapes. Thanks
+       to Philippe Troin <phil@fifi.org> for reporting this bug and
+       providing the test cases.
+
 Changes between versions 0.4b30 and 0.4b31 (released July 30, 2002)
 ===================================================================
 
 Changes between versions 0.4b30 and 0.4b31 (released July 30, 2002)
 ===================================================================
 
diff --git a/THANKS b/THANKS
index 37aaaae83730484575f562a2efdf6994e0063c26..bd8df1eaa94c2432c0f88f9164c30f40e32ee4b5 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -1,4 +1,4 @@
-$Id: THANKS,v 1.68 2002/10/07 19:27:35 stelian Exp $
+$Id: THANKS,v 1.69 2002/11/15 09:25:28 stelian Exp $
 
 Dump and restore were written by the people of the CSRG at the University
 of California, Berkeley.
 
 Dump and restore were written by the people of the CSRG at the University
 of California, Berkeley.
@@ -97,6 +97,7 @@ Jason L Tibbitts III  tibbs@math.uh.edu
 Mike Tibor             tibor@lib.uaa.alaska.edu
 Dirk Traenapp          dtraenapp@users.sourceforge.net
 Erik Troan             ewt@redhat.com
 Mike Tibor             tibor@lib.uaa.alaska.edu
 Dirk Traenapp          dtraenapp@users.sourceforge.net
 Erik Troan             ewt@redhat.com
+Philippe Troin         phil@fifi.org
 Theodore Y. Ts'o       tytso@valinux.com
 Stephen Tweedie                sct@dcs.ed.ac.uk
 Amith Varghese         amithv@yahoo.com
 Theodore Y. Ts'o       tytso@valinux.com
 Stephen Tweedie                sct@dcs.ed.ac.uk
 Amith Varghese         amithv@yahoo.com
index 62deb0d5deecd45f751a3f87131e9fde3a5d770c..6ea57e383065036f182d3b3146192af426126a96 100644 (file)
@@ -5,7 +5,7 @@
  *     Stelian Pop <stelian@popies.net>, 1999-2000
  *     Stelian Pop <stelian@popies.net> - Alcôve <www.alcove.com>, 2000-2002
  *
  *     Stelian Pop <stelian@popies.net>, 1999-2000
  *     Stelian Pop <stelian@popies.net> - Alcôve <www.alcove.com>, 2000-2002
  *
- *     $Id: extern.h,v 1.19 2002/07/29 12:00:34 stelian Exp $
+ *     $Id: extern.h,v 1.20 2002/11/15 09:25:41 stelian Exp $
  */
 
 /*-
  */
 
 /*-
@@ -97,6 +97,7 @@ void           removeoldleaves __P((void));
 void            removeoldnodes __P((void));
 void            renameit __P((char *, char *));
 int             reply __P((const char *));
 void            removeoldnodes __P((void));
 void            renameit __P((char *, char *));
 int             reply __P((const char *));
+void            resizemaps __P((dump_ino_t, dump_ino_t));
 RST_DIR                *rst_opendir __P((const char *));
 struct direct  *rst_readdir __P((RST_DIR *));
 void            rst_closedir __P((RST_DIR *dirp));
 RST_DIR                *rst_opendir __P((const char *));
 struct direct  *rst_readdir __P((RST_DIR *));
 void            rst_closedir __P((RST_DIR *dirp));
index 723a88f00ebf98348fb626b8b7569df99d343faf..c8c76a9536b8dd9818c336b65946e311e5401fea 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.41 2002/07/19 14:57:39 stelian Exp $";
+       "$Id: main.c,v 1.42 2002/11/15 09:25:41 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
@@ -90,8 +90,8 @@ char  command = '\0';
 long   dumpnum = 1;
 long   volno = 0;
 long   ntrec;
 long   dumpnum = 1;
 long   volno = 0;
 long   ntrec;
-char   *dumpmap;
-char   *usedinomap;
+char   *dumpmap = NULL;
+char   *usedinomap = NULL;
 dump_ino_t maxino;
 time_t dumptime;
 time_t dumpdate;
 dump_ino_t maxino;
 time_t dumptime;
 time_t dumpdate;
index 96dee35b32ef44d5d10b898ec6fae81b0d36b52b..3a6b1fbc6b31345577031e8fd7c8f6f7011be575 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: symtab.c,v 1.19 2002/07/19 14:57:40 stelian Exp $";
+       "$Id: symtab.c,v 1.20 2002/11/15 09:25:42 stelian Exp $";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -611,6 +611,7 @@ initsymtable(char *filename)
                panic("initsymtable called from command %c\n", command);
                break;
        }
                panic("initsymtable called from command %c\n", command);
                break;
        }
+       resizemaps(maxino, hdr.maxino);
        maxino = hdr.maxino;
        entrytblsize = hdr.entrytblsize;
        entry = (struct entry **)
        maxino = hdr.maxino;
        entrytblsize = hdr.entrytblsize;
        entry = (struct entry **)
index 3195ab53b4746893ca50f62ef3e085980bd3db60..8b546791d964b183bb7a7ae7ce5bd1f49f67cd0d 100644 (file)
@@ -46,7 +46,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.64 2002/07/29 12:00:34 stelian Exp $";
+       "$Id: tape.c,v 1.65 2002/11/15 09:25:42 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
@@ -374,15 +374,9 @@ setup(void)
        getfile(xtrmap, xtrmapskip);
        while (spcl.c_type == TS_ADDR) {
                /* Recompute maxino and the map */
        getfile(xtrmap, xtrmapskip);
        while (spcl.c_type == TS_ADDR) {
                /* Recompute maxino and the map */
-               char *oldmap = usedinomap;
                dump_ino_t oldmaxino = maxino;
                maxino += (spcl.c_count * TP_BSIZE * NBBY) + 1;
                dump_ino_t oldmaxino = maxino;
                maxino += (spcl.c_count * TP_BSIZE * NBBY) + 1;
-               map = calloc((unsigned)1, (unsigned)howmany(maxino, NBBY));
-               if (map == NULL)
-                       errx(1, "no memory for active inode map");
-               usedinomap = map;
-               memcpy(usedinomap, oldmap, howmany(oldmaxino, NBBY));
-               free(oldmap);
+               resizemaps(oldmaxino, maxino);
 
                spcl.c_dinode.di_size = spcl.c_count * TP_BSIZE;
                getfile(xtrmap, xtrmapskip);
 
                spcl.c_dinode.di_size = spcl.c_count * TP_BSIZE;
                getfile(xtrmap, xtrmapskip);
index e897344a1e0a85ef5bec3d5f0bdb9aee51fae362..16d16746fc6b8fdda7b374358adfe1a6b8c89f41 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: utilities.c,v 1.20 2002/02/04 11:18:46 stelian Exp $";
+       "$Id: utilities.c,v 1.21 2002/11/15 09:25:42 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
@@ -543,3 +543,25 @@ Inode2Tapepos(dump_ino_t ino, long *tnum, long long *tpos, int exactmatch)
        return 0;
 }
 #endif /* USE_QFA */
        return 0;
 }
 #endif /* USE_QFA */
+
+void resizemaps(dump_ino_t oldmax, dump_ino_t newmax)
+{
+       char *map;
+
+       if (usedinomap) {
+               map = calloc((unsigned)1, (unsigned)howmany(newmax, NBBY));
+               if (map == NULL)
+                       errx(1, "no memory for active inode map");
+               memcpy(map, usedinomap, howmany(oldmax, NBBY));
+               free(usedinomap);
+               usedinomap = map;
+       }
+       if (dumpmap) {
+               map = calloc((unsigned)1, (unsigned)howmany(newmax, NBBY));
+               if (map == NULL)
+                       errx(1, "no memory for file dump list");
+               memcpy(map, dumpmap, howmany(oldmax, NBBY));
+               free(dumpmap);
+               dumpmap = map;
+       }
+}