mirror of
https://github.com/fadden/nulib2.git
synced 2025-02-11 12:30:59 +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
|
||||
- Added "original pathname" fields to NuFileDetails and NuErrorStatus.
|
||||
- Changed callback setters to return NuCallback instead of NuError.
|
||||
|
@ -378,8 +378,8 @@ Nu_CopyArchiveRecord(NuArchive* pArchive, NuRecord* pRecord)
|
||||
BailError(err);
|
||||
offsetAdjust = outputOffset - pRecord->fileOffset;
|
||||
|
||||
DBUG(("--- Copying record '%s' (adj=%ld)\n", pRecord->filename,
|
||||
offsetAdjust));
|
||||
DBUG(("--- Copying record '%s' (curOff=%ld adj=%ld)\n", pRecord->filename,
|
||||
outputOffset, offsetAdjust));
|
||||
|
||||
/* seek to the start point in the source file, and copy the whole thing */
|
||||
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 ==
|
||||
(ulong)ftell(pArchive->tmpFp));
|
||||
Assert(pRecord->fileOffset == outputOffset);
|
||||
|
||||
bail:
|
||||
return err;
|
||||
@ -1211,6 +1212,11 @@ Nu_ConstructArchiveRecord(NuArchive* pArchive, NuRecord* pRecord)
|
||||
err = Nu_FSeek(pArchive->tmpFp, finalOffset, SEEK_SET);
|
||||
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:
|
||||
if (err == kNuErrSkipped) {
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user