#ifndef lint
static const char rcsid[] =
- "$Id: tape.c,v 1.98 2010/06/11 09:57:31 stelian Exp $";
+ "$Id: tape.c,v 1.102 2011/06/08 15:40:53 stelian Exp $";
#endif /* not lint */
#include <config.h>
do {
fprintf(stderr, "Specify next volume # (none if no more volumes): ");
(void) fflush(stderr);
- (void) fgets(buf, TP_BSIZE, terminal);
+ if (!fgets(buf, TP_BSIZE, terminal))
+ break;
} while (!feof(terminal) && buf[0] == '\n');
if (feof(terminal))
exit(1);
fprintf(stderr, "otherwise enter tape name (default: %s) ", magtape);
#endif
(void) fflush(stderr);
- (void) fgets(buf, TP_BSIZE, terminal);
+ if (!fgets(buf, TP_BSIZE, terminal))
+ exit(1);
if (feof(terminal))
exit(1);
if (!strcmp(buf, "none\n")) {
}
close(sk);
}
- (void) chown(name, luid, lgid);
- (void) chmod(name, mode);
+ if (chown(name, luid, lgid) < 0)
+ warn("%s: chown", name);
+ if (chmod(name, mode) < 0)
+ warn("%s: chmod", name);
extractattr(name);
utimes(name, timep);
if (flags)
skipfile();
#ifdef HAVE_LCHOWN
- (void) lchown(name, luid, lgid);
+ if (lchown(name, luid, lgid) < 0)
+ warn("%s: lchown", name);
#endif
extractattr(name);
return (GOOD);
return (FAIL);
}
}
- (void) chown(name, luid, lgid);
- (void) chmod(name, mode);
+ if (chown(name, luid, lgid) < 0)
+ warn("%s: chown", name);
+ if (chmod(name, mode) < 0)
+ warn("%s: chmod", name);
extractattr(name);
utimes(name, timep);
if (flags)
return (FAIL);
}
}
- (void) chown(name, luid, lgid);
- (void) chmod(name, mode);
+ if (chown(name, luid, lgid) < 0)
+ warn("%s: chown", name);
+ if (chmod(name, mode) < 0)
+ warn("%s: chmod", name);
extractattr(name);
utimes(name, timep);
if (flags)
}
else
skipfile();
- (void) chown(name, luid, lgid);
- (void) chmod(name, mode);
+ if (chown(name, luid, lgid) < 0)
+ warn("%s: chown", name);
+ if (chmod(name, mode) < 0)
+ warn("%s: chmod", name);
extractattr(name);
utimes(name, timep);
if (flags)
/* and add the resource data from tape */
getfile(xtrfile, xtrskip);
- (void) fchown(ofile, uid, gid);
- (void) fchmod(ofile, mode);
+ if (fchown(ofile, uid, gid) < 0)
+ warn("%s: fchown", name);
+ if (fchmod(ofile, mode) < 0)
+ warn("%s: fchmod", name);
(void) close(ofile);
utimes(oFileRsrc, timep);
(void) lsetflags(oFileRsrc, flags);
last_write_was_hole = 1;
}
if (last_write_was_hole) {
- FTRUNCATE(ofile, origsize);
+ if (FTRUNCATE(ofile, origsize) < 0)
+ warn("%s: ftruncate", curfile.name);
}
if (!readingmaps)
findinode(&spcl);
((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);
((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;
}
if (reason) {
if (lengtherr)
- fprintf(stderr, "%s compressed block: %d expected: %u\n",
- lengtherr, readsize, tpbin->length + PREFIXSIZE);
+ fprintf(stderr, "%s compressed block: %d expected: %lu\n",
+ lengtherr, readsize, (unsigned long)tpbin->length + PREFIXSIZE);
fprintf(stderr, "decompression error, block %ld: %s\n",
tpblksread+1, reason);
if (!cresult)
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;