X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Flist.c;h=3e2d127c606f87704e4a49073004b96b98c4fa33;hb=d8b790047fbbbab143527e42b6eba7e14708afb5;hp=cb14c79bb8ee01240844e0931185e916f9d4903d;hpb=defde325338f14d5a25d113141e8e03d19a7fbe8;p=chaz%2Ftar diff --git a/src/list.c b/src/list.c index cb14c79..3e2d127 100644 --- a/src/list.c +++ b/src/list.c @@ -130,10 +130,19 @@ read_and (void (*do_something) (void)) } set_next_block_after (current_header); + + if (!ignore_zeros_option) + { + char buf[UINTMAX_STRSIZE_BOUND]; + + status = read_header (false); + if (status == HEADER_ZERO_BLOCK) + break; + WARN ((0, 0, _("A lone zero block at %s"), + STRINGIFY_BIGINT (current_block_ordinal (), buf))); + } status = prev_status; - if (ignore_zeros_option) - continue; - break; + continue; case HEADER_END_OF_FILE: if (block_number_option) @@ -386,9 +395,13 @@ read_header (bool raw_extended_headers) *bp = '\0'; } - else if (header->header.typeflag == XHDTYPE - || header->header.typeflag == XGLTYPE) + else if (header->header.typeflag == XHDTYPE) xheader_read (header, OFF_FROM_HEADER (header->header.size)); + else if (header->header.typeflag == XGLTYPE) + { + xheader_read (header, OFF_FROM_HEADER (header->header.size)); + xheader_decode_global (); + } /* Loop! */ @@ -550,7 +563,8 @@ decode_header (union block *header, struct tar_stat_info *stat_info, { case BLKTYPE: case CHRTYPE: - stat_info->stat.st_rdev = makedev (stat_info->devmajor, stat_info->devminor); + stat_info->stat.st_rdev = makedev (stat_info->devmajor, + stat_info->devminor); break; default: @@ -558,9 +572,8 @@ decode_header (union block *header, struct tar_stat_info *stat_info, } } + xheader_decode (stat_info); current_stat_info.archive_file_size = current_stat_info.stat.st_size; - if (extended_header.size) - xheader_decode (stat_info); } /* Convert buffer at WHERE0 of size DIGS from external format to @@ -1096,7 +1109,8 @@ print_header (struct tar_stat_info *st, off_t block_ordinal) uintbuf)); break; default: - strcpy (size, STRINGIFY_BIGINT (st->stat.st_size, uintbuf)); + /* st->stat.st_size keeps stored file size */ + strcpy (size, STRINGIFY_BIGINT (st->archive_file_size, uintbuf)); break; }