diff options
author | cperciva <cperciva@FreeBSD.org> | 2007-04-02 04:21:22 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2007-04-02 04:21:22 +0000 |
commit | b975b5f5f0f06cdd1235d5fa049cb2510ed3cd91 (patch) | |
tree | e2dec9f93fa5147dfd733d05901d56ede327bdea /lib/libarchive | |
parent | c9d2b95e455e66bf1e2953cb0fe5f87a8384d72d (diff) | |
download | FreeBSD-src-b975b5f5f0f06cdd1235d5fa049cb2510ed3cd91.zip FreeBSD-src-b975b5f5f0f06cdd1235d5fa049cb2510ed3cd91.tar.gz |
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.
Diffstat (limited to 'lib/libarchive')
-rw-r--r-- | lib/libarchive/archive_read_support_format_tar.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/libarchive/archive_read_support_format_tar.c b/lib/libarchive/archive_read_support_format_tar.c index 3c24733..8228c1e 100644 --- a/lib/libarchive/archive_read_support_format_tar.c +++ b/lib/libarchive/archive_read_support_format_tar.c @@ -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; |