]> git.wh0rd.org - dump.git/commitdiff
Bug in getvol() when making a wrong answer to the 'Mount next volume' prompt.
authorStelian Pop <stelian@popies.net>
Wed, 18 Jul 2001 14:57:46 +0000 (14:57 +0000)
committerStelian Pop <stelian@popies.net>
Wed, 18 Jul 2001 14:57:46 +0000 (14:57 +0000)
CHANGES
restore/tape.c

diff --git a/CHANGES b/CHANGES
index 9cae80d4c246bd2723ff34545900173ea8c81820..7a4457a89cd8cca365ab4b47b26cb341450d7987 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.123 2001/07/18 13:12:33 stelian Exp $
+$Id: CHANGES,v 1.124 2001/07/18 14:57:46 stelian Exp $
 
 Changes between versions 0.4b22 and 0.4b23 (released ????????????)
 ==================================================================
@@ -39,6 +39,10 @@ Changes between versions 0.4b22 and 0.4b23 (released ????????????)
        <uwe@ugsoft.de>, and some recommendations for QFA uses in
        the man pages.
 
+10.    Fixed the multivolume restoring where making a mistake
+       to the 'Mount next tape' prompt caused several blocks to
+       be lost.
+
 Changes between versions 0.4b21 and 0.4b22 (released May 12, 2001)
 ==================================================================
 
index 360cb1786aac25cb02a8862577826262fe28408a..08bb3757e7b638ece4d9f09048abb9d9072df6a5 100644 (file)
@@ -46,7 +46,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.43 2001/07/18 13:46:17 stelian Exp $";
+       "$Id: tape.c,v 1.44 2001/07/18 14:57:46 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -379,7 +379,8 @@ setup(void)
 void
 getvol(long nextvol)
 {
-       long newvol = 0, savecnt = 0, wantnext = 0, i;
+       long newvol = 0, wantnext = 0, i;
+       long saved_blksread = 0, saved_tpblksread = 0;
        union u_spcl tmpspcl;
 #      define tmpbuf tmpspcl.s_spcl
        char buf[TP_BSIZE];
@@ -396,7 +397,8 @@ getvol(long nextvol)
                        return;
                goto gethdr;
        }
-       savecnt = blksread;
+       saved_blksread = blksread;
+       saved_tpblksread = tpblksread;
 again:
        if (pipein)
                exit(1); /* pipes do not get a second chance */
@@ -499,12 +501,16 @@ gethdr:
                fprintf(stderr, "tape is not dump tape\n");
                volno = 0;
                haderror = 1;
+               blksread = saved_blksread;
+               tpblksread = saved_tpblksread;
                goto again;
        }
        if (tmpbuf.c_volume != volno) {
                fprintf(stderr, "Wrong volume (%d)\n", tmpbuf.c_volume);
                volno = 0;
                haderror = 1;
+               blksread = saved_blksread;
+               tpblksread = saved_tpblksread;
                goto again;
        }
        if (tmpbuf.c_date != dumpdate || tmpbuf.c_ddate != dumptime) {
@@ -513,10 +519,13 @@ gethdr:
                fprintf(stderr, "\twanted: %s", ctime(&dumpdate));
                volno = 0;
                haderror = 1;
+               blksread = saved_blksread;
+               tpblksread = saved_tpblksread;
                goto again;
        }
        tapesread |= 1 << volno;
-       blksread = savecnt;
+       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.