Article View: net.bugs
Article #423Re: Tar EOT bug and fix (with correction)
From: Bill Vaughn
Date: Thu, 21 Mar 1985 05:36
Date: Thu, 21 Mar 1985 05:36
94 lines
2818 bytes
2818 bytes
Sorry, I screwed up my first bug-fix posting. No excuses.
Here it is again. (Actually, this is not exactlly the way I fixed
my version. But the way I did it works. This method should work also.)
Corrections are noted by !!---> .
*** tar.org.c
--- tar.fix.c Tue Mar 19 16:25:19 1985
***************
*** 1092,1101
{
first = 1;
if (recno >= nblock) {
! if (write(mt, tbuf, TBLOCK*nblock) < 0) {
! fprintf(stderr, "tar: tape write error\n");
! done(2);
! }
recno = 0;
}
bcopy(buffer, (char *)&tbuf[recno++], TBLOCK);
--- 1092,1098 -----
{
first = 1;
if (recno >= nblock) {
! flushtape();
recno = 0;
}
bcopy(buffer, (char *)&tbuf[recno++], TBLOCK);
***************
*** 1100,1109
}
bcopy(buffer, (char *)&tbuf[recno++], TBLOCK);
if (recno >= nblock) {
! if (write(mt, tbuf, TBLOCK*nblock) < 0) {
! fprintf(stderr, "tar: tape write error\n");
! done(2);
! }
recno = 0;
}
return (TBLOCK);
--- 1097,1103 -----
}
bcopy(buffer, (char *)&tbuf[recno++], TBLOCK);
if (recno >= nblock) {
! flushtape();
recno = 0;
}
return (TBLOCK);
***************
*** 1129,1135
flushtape()
{
! write(mt, tbuf, TBLOCK*nblock);
}
bread(fd, buf, size)
--- 1123,1147 -----
flushtape()
{
! register int n;
!
! if ((n=write(mt, tbuf, TBLOCK*nblock)) != TBLOCK*nblock) {
! if (n)
! fprintf(stderr, "tar: tape write error\n");
!!---> else {
! fprintf(stderr, "tar: EOT mark encountered. ");
! /*
! * With a little work one could decide if the
! * following is really true. Be conservative.
! */
! fprintf(stderr, "Last file is incomplete.\n");
! /*
! * The following keeps subsequent reads happy.
! */
! bzero(tbuf, TBLOCK*nblock);
! write(mt, tbuf, TBLOCK*nblock);
!!---> }
! done(2);
! }
}
bread(fd, buf, size)
***********************
Bill Vaughn, U. of Rochester
{allegra,seismo,decvax}!rochester!ur-cvsvax!bill
"Hey, you're going to love this program now that
I've added all of these new bu ... er, features."
Anonymous Hacker
Technical Details
Message-ID:
<180@ur-cvsvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!rochester!ur-cvsvax!billReferences:
<179@ur-cvsvax.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site ur-cvsvax.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!rochester!ur-cvsvax!bill From: bill@ur-cvsvax.UUCP (Bill Vaughn) Newsgroups: net.bugs Subject: Re: Tar EOT bug and fix (with correction) Message-ID: <180@ur-cvsvax.UUCP> Date: Thu, 21-Mar-85 00:36:49 EST Article-I.D.: ur-cvsva.180 Posted: Thu Mar 21 00:36:49 1985 Date-Received: Fri, 22-Mar-85 01:54:05 EST References: <179@ur-cvsvax.UUCP> Distribution: net Organization: Center for Visual Science, U. of Rochester Lines: 94