diff options
author | jh <jh@FreeBSD.org> | 2010-02-20 13:35:05 +0000 |
---|---|---|
committer | jh <jh@FreeBSD.org> | 2010-02-20 13:35:05 +0000 |
commit | 788735d99460cec9bb4b0151b39ae11bb8477a84 (patch) | |
tree | 77dea1854079df29f20658d64b261f88c3f8c479 | |
parent | f4d82f779dd38463086ebabdcc43a54e46d74b82 (diff) | |
download | FreeBSD-src-788735d99460cec9bb4b0151b39ae11bb8477a84.zip FreeBSD-src-788735d99460cec9bb4b0151b39ae11bb8477a84.tar.gz |
MFC r203157, r203816:
Handle short reads when the -P option is used and remove some dead code.
PR: bin/121502
-rw-r--r-- | sbin/restore/tape.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c index debed5f..c884dee 100644 --- a/sbin/restore/tape.c +++ b/sbin/restore/tape.c @@ -227,7 +227,7 @@ setup(void) volno = 1; setdumpnum(); FLUSHTAPEBUF(); - if (!pipein && !bflag) + if (!pipein && !pipecmdin && !bflag) findtapeblksize(); if (gethead(&spcl) == FAIL) { fprintf(stderr, "Tape is not a dump tape\n"); @@ -333,10 +333,6 @@ getvol(long nextvol) } if (volno == 1) return; - if (pipecmdin) { - closemt(); - goto getpipecmdhdr; - } goto gethdr; } again: @@ -400,7 +396,6 @@ again: if (pipecmdin) { char volno[sizeof("2147483647")]; -getpipecmdhdr: (void)sprintf(volno, "%d", newvol); if (setenv("RESTORE_VOLUME", volno, 1) == -1) { fprintf(stderr, "Cannot set $RESTORE_VOLUME: %s\n", @@ -1204,17 +1199,17 @@ getmore: * Check for mid-tape short read error. * If found, skip rest of buffer and start with the next. */ - if (!pipein && numtrec < ntrec && i > 0) { + if (!pipein && !pipecmdin && numtrec < ntrec && i > 0) { dprintf(stdout, "mid-media short read error.\n"); numtrec = ntrec; } /* * Handle partial block read. */ - if (pipein && i == 0 && rd > 0) + if ((pipein || pipecmdin) && i == 0 && rd > 0) i = rd; else if (i > 0 && i != ntrec * TP_BSIZE) { - if (pipein) { + if (pipein || pipecmdin) { rd += i; cnt -= i; if (cnt > 0) |