From: Stelian Pop <stelian@popies.net>
Date: Mon, 6 May 2002 08:45:41 +0000 (+0000)
Subject: Fix restore when inode maps are not entirely contained on the first volume.
X-Git-Tag: release_0_4b29~7
X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=ff9e45da1a0be7807fb18401ca7e5ee28d0e1007;p=dump.git

Fix restore when inode maps are not entirely contained on the first volume.
---

diff --git a/CHANGES b/CHANGES
index e055370..1f139e5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.173 2002/04/15 11:57:27 stelian Exp $
+$Id: CHANGES,v 1.174 2002/05/06 08:45:41 stelian Exp $
 
 Changes between versions 0.4b28 and 0.4b29 (released ??????????????)
 ====================================================================
@@ -10,6 +10,11 @@ Changes between versions 0.4b28 and 0.4b29 (released ??????????????)
 	Jörg Schilling <schilling@fokus.gmd.de> for reporting this bug and
 	providing an excellent, cross-platform replacement for rmt in his
 	star package.
+
+2.	Fixed a bug reported by Andy Mentges <amentges@jumpline.com>
+	which caused restore to fail when the inode maps were not entirely
+	contained on the first volume (when using really small volumes or
+	when dumping a huge number of inodes).
 	
 Changes between versions 0.4b27 and 0.4b28 (released April 12, 2002)
 ====================================================================
diff --git a/restore/tape.c b/restore/tape.c
index 453b7eb..1b6b1d9 100644
--- a/restore/tape.c
+++ b/restore/tape.c
@@ -46,7 +46,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-	"$Id: tape.c,v 1.60 2002/04/04 08:20:23 stelian Exp $";
+	"$Id: tape.c,v 1.61 2002/05/06 08:45:41 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -431,6 +431,8 @@ getvol(long nextvol)
 	if (nextvol == 1) {
 		tapesread = 0;
 		gettingfile = 0;
+		tpblksread = 0;
+		blksread = 0;
 	}
 	if (pipein) {
 		if (nextvol != 1)
@@ -587,8 +589,6 @@ gethdr:
 		goto again;
 	}
 	tapesread |= 1 << volno;
-	blksread = saved_blksread;
-	tpblksread = saved_tpblksread;
  	/*
  	 * If continuing from the previous volume, skip over any
  	 * blocks read already at the end of the previous volume.
@@ -603,10 +603,10 @@ gethdr:
 #endif /* !HAVE_ZLIB && !HAVE_BZLIB */
 	}
 	Dprintf(stdout, "read %ld recs, tape starts with %ld\n",
-		tpblksread, (long)tmpbuf.c_firstrec);
+		tpblksread - 1, (long)tmpbuf.c_firstrec);
  	if (tmpbuf.c_type == TS_TAPE && (tmpbuf.c_flags & DR_NEWHEADER)) {
  		if (!wantnext) {
- 			tpblksread = tmpbuf.c_firstrec;
+ 			tpblksread = tmpbuf.c_firstrec + 1;
  			for (i = tmpbuf.c_count; i > 0; i--)
  				readtape(buf);
  		} else if (tmpbuf.c_firstrec > 0 &&