#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.63 2002/07/19 14:57:40 stelian Exp $";
#endif /* not lint */
#include <config.h>
#ifdef RRESTORE
if (host)
- mt = rmtopen(temptape, 0);
+ mt = rmtopen(temptape, "O_RDONLY");
else
#endif
if (pipein)
if (vflag || command == 't' || command == 'C')
printdumpinfo();
#ifdef USE_QFA
- if (tapeposflag && spcl.c_date != qfadumpdate)
+ if (tapeposflag && (unsigned long)spcl.c_date != qfadumpdate)
errx(1, "different QFA/dumpdates detected\n");
#endif
if (filesys[0] == '\0') {
if (nextvol == 1) {
tapesread = 0;
gettingfile = 0;
+ tpblksread = 0;
+ blksread = 0;
}
if (pipein) {
if (nextvol != 1)
}
#ifdef RRESTORE
if (host)
- mt = rmtopen(magtape, 0);
+ mt = rmtopen(magtape, "O_RDONLY");
else
#endif
mt = OPEN(magtape, O_RDONLY, 0);
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.
#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 &&
if (volinfo[1] == ROOTINO) {
printf("Starting inode numbers by volume:\n");
- for (i = 1; i < TP_NINOS && volinfo[i] != 0; ++i)
+ for (i = 1; i < (int)TP_NINOS && volinfo[i] != 0; ++i)
printf("\tVolume %d: %lu\n", i, (unsigned long)volinfo[i]);
}
}
*/
/* ARGSUSED */
static void
-xtrskip(char *buf, size_t size)
+xtrskip(UNUSED(char *buf), size_t size)
{
if (LSEEK(ofile, (off_t)size, SEEK_CUR) == -1)
*/
/* ARGSUSED */
static void
-xtrlnkskip(char *buf, size_t size)
+xtrlnkskip(UNUSED(char *buf), UNUSED(size_t size))
{
errx(1, "unallocated block in symbolic link %s", curfile.name);
*/
/* ARGSUSED */
static void
-xtrmapskip(char *buf, size_t size)
+xtrmapskip(UNUSED(char *buf), size_t size)
{
panic("hole in map\n");
*/
/* ARGSUSED */
void
-xtrnull(char *buf, size_t size)
+xtrnull(UNUSED(char *buf), UNUSED(size_t size))
{
return;
if (cmperror)
return;
- if (read(ifile, cmpbuf, size) != size) {
+ if (read(ifile, cmpbuf, size) != (ssize_t)size) {
fprintf(stderr, "%s: size has changed.\n",
curfile.name);
cmperror = 1;
* Skip over a hole in a file.
*/
static void
-xtrcmpskip(char *buf, size_t size)
+xtrcmpskip(UNUSED(char *buf), size_t size)
{
static char cmpbuf[MAXBSIZE];
int i;
if (cmperror)
return;
- if (read(ifile, cmpbuf, size) != size) {
+ if (read(ifile, cmpbuf, size) != (ssize_t)size) {
fprintf(stderr, "%s: size has changed.\n",
curfile.name);
cmperror = 1;
return;
}
- for (i = 0; i < size; ++i)
+ for (i = 0; i < (int)size; ++i)
if (cmpbuf[i] != '\0') {
fprintf(stderr, "%s: tape and disk copies are different\n",
curfile.name);
void
comparefile(char *name)
{
- int mode;
+ unsigned int mode;
struct STAT sb;
int r;
#if !COMPARE_ONTHEFLY
return;
}
- if (sb.st_rdev != (int)curfile.dip->di_rdev) {
+ if (sb.st_rdev != (dev_t)curfile.dip->di_rdev) {
fprintf(stderr,
"%s: device changed from %d,%d to %d,%d.\n",
name,
/* read the block prefix */
ret = read_a_block(mt, tapebuf, PREFIXSIZE, &rl);
- if (Vflag && (ret == 0 || rl < PREFIXSIZE || tpb->length == 0))
+ if (Vflag && (ret == 0 || rl < (int)PREFIXSIZE || tpb->length == 0))
ret = 0;
if (ret <= 0)
goto readerr;
/* build a length error message */
blocklen = tpbin->length;
- if (readsize < blocklen + PREFIXSIZE)
+ if (readsize < blocklen + (int)PREFIXSIZE)
lengtherr = "short";
else
- if (readsize > blocklen + PREFIXSIZE)
+ if (readsize > blocklen + (int)PREFIXSIZE)
lengtherr = "long";
worklen = comprlen;
len = bufsize - TP_BSIZE;
}
if (read_a_block(mt, tapebuf+TP_BSIZE, len, &i) < 0
- || (i != len && i % TP_BSIZE != 0))
+ || (i != (long)len && i % TP_BSIZE != 0))
errx(1,"Error reading dump file header");
tbufptr = tapebuf;
numtrec = ntrec;