1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

Now that there is always a compression-layer skip function available,

skip over the end-of-entry padding instead of reading and discarding
it.

Considering that tar files normally have a block size of 10kB, this
isn't likely to avoid reading any data, but at least it makes the code
simpler and clearer.
This commit is contained in:
Colin Percival 2007-04-02 04:21:22 +00:00
parent 18ecc1de7a
commit eeb83a6572
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168249

View File

@ -524,15 +524,9 @@ archive_read_format_tar_read_data(struct archive_read *a,
(a->compression_read_consume)(a, bytes_read);
return (ARCHIVE_OK);
} else {
while (tar->entry_padding > 0) {
bytes_read = (a->compression_read_ahead)(a, buff, 1);
if (bytes_read <= 0)
return (ARCHIVE_FATAL);
if (bytes_read > tar->entry_padding)
bytes_read = tar->entry_padding;
(a->compression_read_consume)(a, bytes_read);
tar->entry_padding -= bytes_read;
}
if ((a->compression_skip)(a, tar->entry_padding) < 0)
return (ARCHIVE_FATAL);
tar->entry_padding = 0;
*buff = NULL;
*size = 0;
*offset = tar->entry_offset;