]> git.wh0rd.org - dump.git/blobdiff - restore/tape.c
Fix fgets bug when asking for a tape name.
[dump.git] / restore / tape.c
index 45d156f5abd02dfeff2b2fd718f9daf7b29ff8f6..7debfd16a054bae6ac243c8f1914e0279cde2505 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.99 2010/06/11 11:19:17 stelian Exp $";
+       "$Id: tape.c,v 1.102 2011/06/08 15:40:53 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
@@ -586,7 +586,7 @@ again:
                fprintf(stderr, "otherwise enter tape name (default: %s) ", magtape);
 #endif
                (void) fflush(stderr);
-               if (fgets(buf, TP_BSIZE, terminal))
+               if (!fgets(buf, TP_BSIZE, terminal))
                        exit(1);
                if (feof(terminal))
                        exit(1);
@@ -2143,6 +2143,10 @@ readtape_comprfile(char *buf)
                ((struct s_spcl *)&tapebuf[i * TP_BSIZE])->c_magic = 0;
        numtrec = ntrec;
        tpb = (struct tapebuf *) tapebuf;
+#ifdef USE_QFA
+       if (createtapeposflag)
+               (void)GetTapePos(&curtapepos);
+#endif
 
        /* read the block prefix */
        ret = read_a_block(mt, tapebuf, PREFIXSIZE, &rl);
@@ -2232,6 +2236,10 @@ readtape_comprtape(char *buf)
                ((struct s_spcl *)&tapebuf[i * TP_BSIZE])->c_magic = 0;
        numtrec = ntrec;
        tpb = (struct tapebuf *) tapebuf;
+#ifdef USE_QFA
+       if (createtapeposflag)
+               (void)GetTapePos(&curtapepos);
+#endif
 
        /* read the block */
        size = bufsize + PREFIXSIZE;
@@ -3336,11 +3344,14 @@ ReReadInodeFromTape(dump_ino_t theino)
                cntloop++;
                gethead(&spcl);
        } while (!(spcl.c_inumber == theino && spcl.c_type == TS_INODE && spcl.c_date == dumpdate));
+
+       tpblksread = spcl.c_tapea + spcl.c_volume;
 #ifdef DEBUG_QFA
        fprintf(stderr, "DEBUG: %ld reads\n", cntloop);
        fprintf(stderr, "DEBUG: bufsize %ld\n", bufsize);
        fprintf(stderr, "DEBUG: ntrec %ld\n", ntrec);
-       fprintf(stderr, "DEBUG: %ld reads\n", cntloop);
+       fprintf(stderr, "DEBUG: tapea %d\n", spcl.c_tapea);
+       fprintf(stderr, "DEBUG: tpblksread %ld\n", tpblksread);
 #endif
        findinode(&spcl);
        noresyncmesg = 0;