]> git.wh0rd.org - dump.git/blobdiff - restore/utilities.c
Fix maps overflow in restore when doing incremental restores (and MAXINO becomes...
[dump.git] / restore / utilities.c
index 627e147875ee44d5454aa4f8810f8462e852ed97..16d16746fc6b8fdda7b374358adfe1a6b8c89f41 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: utilities.c,v 1.19 2002/01/25 15:09:00 stelian Exp $";
+       "$Id: utilities.c,v 1.21 2002/11/15 09:25:42 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -236,7 +236,7 @@ linkit(char *existing, char *new, int type)
 
                if (!Nflag && (ret = link(existing, new)) < 0) {
 
-#ifndef __linux__
+#if !defined(__linux__) && !defined(sunos)
                        struct stat s;
 
                        /*
@@ -276,7 +276,7 @@ linkit(char *existing, char *new, int type)
        return (GOOD);
 }
 
-#ifndef        __linux__
+#if !defined(__linux__) && !defined(sunos)
 /*
  * Create a whiteout.
  */
@@ -543,3 +543,25 @@ Inode2Tapepos(dump_ino_t ino, long *tnum, long long *tpos, int exactmatch)
        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;
+       }
+}