]> git.wh0rd.org - dump.git/blobdiff - restore/tape.c
Fixed a problem when reading tapes written with ancient dump versions on big endian...
[dump.git] / restore / tape.c
index 453b7eb276e533f694cfc73bfdd7d2ae0b8c32c1..558e8f3680a9ecbacdf0cf2e196cb197d25da2d4 100644 (file)
@@ -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.62 2002/05/21 15:48:46 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -285,7 +285,7 @@ setup(void)
 
 #ifdef RRESTORE
        if (host)
-               mt = rmtopen(temptape, 0);
+               mt = rmtopen(temptape, "O_RDONLY");
        else
 #endif
        if (pipein)
@@ -431,6 +431,8 @@ getvol(long nextvol)
        if (nextvol == 1) {
                tapesread = 0;
                gettingfile = 0;
+               tpblksread = 0;
+               blksread = 0;
        }
        if (pipein) {
                if (nextvol != 1)
@@ -539,7 +541,7 @@ again:
        }
 #ifdef RRESTORE
        if (host)
-               mt = rmtopen(magtape, 0);
+               mt = rmtopen(magtape, "O_RDONLY");
        else
 #endif
                mt = OPEN(magtape, O_RDONLY, 0);
@@ -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 &&