diff options
author | Rob Landley <rob@landley.net> | 2019-05-19 23:18:26 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-05-19 23:18:26 -0500 |
commit | e6460141851d3af158eefe9ade4cff75017e3a87 (patch) | |
tree | b339242876f65cfc0d099f347c779402e560be6c /toys/posix | |
parent | 6534204a7ac32fe8009d0d14189dfa86826b14a5 (diff) | |
download | toybox-e6460141851d3af158eefe9ade4cff75017e3a87.tar.gz |
Fix tar sparse extract with extension blocks.
Diffstat (limited to 'toys/posix')
-rw-r--r-- | toys/posix/tar.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/toys/posix/tar.c b/toys/posix/tar.c index ecc378b7..10535f37 100644 --- a/toys/posix/tar.c +++ b/toys/posix/tar.c @@ -439,7 +439,7 @@ static void sendfile_sparse(int fd) long long len, used = 0, sent; int i = 0, j; - for (;;) { + do { if (TT.sparselen) { if (!TT.sparse[i*2+1]) continue; // Seek past holes or fill output with zeroes. @@ -465,9 +465,7 @@ error: break; } - - if (++i >= TT.sparselen) break; - } + } while (++i<TT.sparselen); close(fd); } @@ -635,10 +633,9 @@ static void unpack_tar(struct tar_hdr *first) if (++i>max || !*s) { if (!(*sparse ? sparse[504] : ((char *)&tar)[482])) break; xreadall(TT.fd, s = sparse, 512); - max = 42; + max = 41; i = 0; } - // Load next entry TT.sparse[TT.sparselen++] = otoi(s, 12); s += 12; |