summaryrefslogtreecommitdiffstats
path: root/sbin/restore
diff options
context:
space:
mode:
authorjh <jh@FreeBSD.org>2010-01-29 10:04:00 +0000
committerjh <jh@FreeBSD.org>2010-01-29 10:04:00 +0000
commit929aea7f326dc9875e3ee96254fec30a4a37eb4b (patch)
tree0dd1cca5caea865079e94f0aaaaeaf7016b489ea /sbin/restore
parent48cf0eb45ce976ce90280d2086542bc0dda0a789 (diff)
downloadFreeBSD-src-929aea7f326dc9875e3ee96254fec30a4a37eb4b.zip
FreeBSD-src-929aea7f326dc9875e3ee96254fec30a4a37eb4b.tar.gz
- Handle short reads when the -P option is used. Short reads must be
handled when reading from pipes. - Remove dead code related to the -P option from getvol(). pipein and pipecmdin are never set at the same time. PR: bin/121502 Approved by: trasz (mentor) MFC after: 2 weeks
Diffstat (limited to 'sbin/restore')
-rw-r--r--sbin/restore/tape.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c
index 6509031..1355aff 100644
--- a/sbin/restore/tape.c
+++ b/sbin/restore/tape.c
@@ -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, "%ld", newvol);
if (setenv("RESTORE_VOLUME", volno, 1) == -1) {
fprintf(stderr, "Cannot set $RESTORE_VOLUME: %s\n",
@@ -1205,17 +1200,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)
OpenPOWER on IntegriCloud