summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-30 11:31:54 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-30 11:31:54 +0200
commit3e920038ecd8cc123b0c8dd957f94a8e1a616c0c (patch)
tree292e08fb8ccdd5fab5f5068a37fe39a32fc3b8a0 /lib
parent8c449c503f4c37f72089a0dc50e00631a22ed12a (diff)
tar reader: also store condensed size of sparse files
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/tar/read_header.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/tar/read_header.c b/lib/tar/read_header.c
index 44a38f9..5d2a808 100644
--- a/lib/tar/read_header.c
+++ b/lib/tar/read_header.c
@@ -613,16 +613,6 @@ int read_header(int fd, tar_header_decoded_t *out)
goto fail;
continue;
case TAR_TYPE_GNU_SPARSE:
- if (!(set_by_pax & PAX_SIZE)) {
- if (read_number(hdr.tail.gnu.realsize,
- sizeof(hdr.tail.gnu.realsize),
- &pax_size))
- goto fail;
-
- out->sb.st_size = pax_size;
- set_by_pax |= PAX_SIZE;
- }
-
free_sparse_list(out->sparse);
out->sparse = read_gnu_old_sparse(fd, &hdr);
if (out->sparse == NULL)
@@ -635,6 +625,15 @@ int read_header(int fd, tar_header_decoded_t *out)
if (decode_header(&hdr, set_by_pax, out, version))
goto fail;
+ if (hdr.typeflag == TAR_TYPE_GNU_SPARSE) {
+ if (read_number(hdr.tail.gnu.realsize,
+ sizeof(hdr.tail.gnu.realsize), &pax_size))
+ goto fail;
+
+ out->sparse_size = out->sb.st_size;
+ out->sb.st_size = pax_size;
+ }
+
return 0;
out_eof:
clear_header(out);