-$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 ?????????????)
 ===================================================================
        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)
 ===================================================================
 
 
-$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.
 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
 
  *     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 $
  */
 
 /*-
 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));
 
 
 #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>
 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;
 
 
 #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 */
 
 /*
                panic("initsymtable called from command %c\n", command);
                break;
        }
+       resizemaps(maxino, hdr.maxino);
        maxino = hdr.maxino;
        entrytblsize = hdr.entrytblsize;
        entry = (struct entry **)
 
 
 #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>
        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;
-               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);
 
 
 #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>
        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;
+       }
+}