mirror of
https://github.com/fadden/nulib2.git
synced 2024-05-28 23:41:29 +00:00
Fixed a rare bug. Put two files in an archive, recompress them (use
exerciser dt/at after sev 2 10), flush, then delete the first one and flush. The archive gets trashed, because the record's fileOffset wasn't getting updated properly.
This commit is contained in:
parent
3c2721d6f8
commit
b5a25968d6
|
@ -1,3 +1,7 @@
|
||||||
|
2003/02/22 fadden
|
||||||
|
- Turn off EOL conversion when extracting disk images.
|
||||||
|
- Added NuTestRecord().
|
||||||
|
|
||||||
2003/02/18 fadden
|
2003/02/18 fadden
|
||||||
- Added "original pathname" fields to NuFileDetails and NuErrorStatus.
|
- Added "original pathname" fields to NuFileDetails and NuErrorStatus.
|
||||||
- Changed callback setters to return NuCallback instead of NuError.
|
- Changed callback setters to return NuCallback instead of NuError.
|
||||||
|
|
|
@ -378,8 +378,8 @@ Nu_CopyArchiveRecord(NuArchive* pArchive, NuRecord* pRecord)
|
||||||
BailError(err);
|
BailError(err);
|
||||||
offsetAdjust = outputOffset - pRecord->fileOffset;
|
offsetAdjust = outputOffset - pRecord->fileOffset;
|
||||||
|
|
||||||
DBUG(("--- Copying record '%s' (adj=%ld)\n", pRecord->filename,
|
DBUG(("--- Copying record '%s' (curOff=%ld adj=%ld)\n", pRecord->filename,
|
||||||
offsetAdjust));
|
outputOffset, offsetAdjust));
|
||||||
|
|
||||||
/* seek to the start point in the source file, and copy the whole thing */
|
/* seek to the start point in the source file, and copy the whole thing */
|
||||||
err = Nu_FSeek(pArchive->archiveFp, pRecord->fileOffset, SEEK_SET);
|
err = Nu_FSeek(pArchive->archiveFp, pRecord->fileOffset, SEEK_SET);
|
||||||
|
@ -399,6 +399,7 @@ Nu_CopyArchiveRecord(NuArchive* pArchive, NuRecord* pRecord)
|
||||||
|
|
||||||
Assert(outputOffset + pRecord->recHeaderLength + pRecord->totalCompLength ==
|
Assert(outputOffset + pRecord->recHeaderLength + pRecord->totalCompLength ==
|
||||||
(ulong)ftell(pArchive->tmpFp));
|
(ulong)ftell(pArchive->tmpFp));
|
||||||
|
Assert(pRecord->fileOffset == outputOffset);
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
return err;
|
return err;
|
||||||
|
@ -1211,6 +1212,11 @@ Nu_ConstructArchiveRecord(NuArchive* pArchive, NuRecord* pRecord)
|
||||||
err = Nu_FSeek(pArchive->tmpFp, finalOffset, SEEK_SET);
|
err = Nu_FSeek(pArchive->tmpFp, finalOffset, SEEK_SET);
|
||||||
BailError(err);
|
BailError(err);
|
||||||
|
|
||||||
|
/* update the record's fileOffset to reflect its new position */
|
||||||
|
DBUG(("+++ record shifted by %ld bytes\n",
|
||||||
|
initialOffset - pRecord->fileOffset));
|
||||||
|
pRecord->fileOffset = initialOffset;
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
if (err == kNuErrSkipped) {
|
if (err == kNuErrSkipped) {
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user