From: Stelian Pop Date: Wed, 18 Jul 2001 14:57:46 +0000 (+0000) Subject: Bug in getvol() when making a wrong answer to the 'Mount next volume' prompt. X-Git-Tag: release_0_4b23~5 X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=commitdiff_plain;h=651fb4a593dfd7a31129b7feb8d5dbd57c6f145d Bug in getvol() when making a wrong answer to the 'Mount next volume' prompt. --- diff --git a/CHANGES b/CHANGES index 9cae80d..7a4457a 100644 --- 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 ????????????) , 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) ================================================================== diff --git a/restore/tape.c b/restore/tape.c index 360cb17..08bb375 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -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 @@ -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.