X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=restore%2Ftape.c;h=9bfb4c5051e74098d6cfa38670cf84d8fcf36ce9;hp=145f769b949308e38e343a60bd7bbaf4f2e7c098;hb=2d32c89c9844547c83ef7a9ca97308da29e280cc;hpb=1176b3c1cb187c6c9f223c154fb4d58910717d18 diff --git a/restore/tape.c b/restore/tape.c index 145f769..9bfb4c5 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -46,7 +46,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.68 2003/02/11 09:56:48 stelian Exp $"; + "$Id: tape.c,v 1.69 2003/02/11 12:43:45 stelian Exp $"; #endif /* not lint */ #include @@ -286,7 +286,7 @@ setup(void) temptape = magtape; #ifdef RRESTORE - if (host) + if (!Afile && host) mt = rmtopen(temptape, O_RDONLY); else #endif @@ -295,7 +295,7 @@ setup(void) else mt = OPEN(temptape, O_RDONLY, 0); if (mt < 0) - err(1, "%s", magtape); + err(1, "%s", temptape); if (!Afile) { volno = 1; setmagtapein(); @@ -502,6 +502,13 @@ again: return; } closemt(); + + /* + * if using an archive file, reset its name so readtape() + * could properly use remote access. + */ + Afile = NULL; + if (Mflag) { snprintf(magtape, MAXPATHLEN, "%s%03ld", magtapeprefix, newvol); magtape[MAXPATHLEN - 1] = '\0'; @@ -1487,7 +1494,7 @@ readtape(char *buf) #endif getmore: #ifdef RRESTORE - if (host) + if (!Afile && host) i = rmtread(&tapebuf[rd], cnt); else #endif @@ -1549,7 +1556,7 @@ getmore: i = ntrec * TP_BSIZE; memset(tapebuf, 0, (size_t)i); #ifdef RRESTORE - if (host) + if (!Afile && host) seek_failed = (rmtseek(i, 1) < 0); else #endif @@ -2030,7 +2037,7 @@ static int read_a_block(int fd, char *buf, size_t len, long *lengthread) size = len; while (size > 0) { #ifdef RRESTORE - if (host) + if (!Afile && host) i = rmtread(buf, size); else #endif @@ -2054,7 +2061,7 @@ closemt(void) if (mt < 0) return; #ifdef RRESTORE - if (host) + if (!Afile && host) rmtclose(); else #endif