diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-13 17:52:42 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-13 17:52:42 +0000 |
commit | 23ffb6a4a2a01fe41abe4e42d46fa16bdc2603fd (patch) | |
tree | 2627bf7cfc0d748ec007f0d6a2d23ad1ff985c59 | |
parent | 6dd03f04ea3292d10ce06feda2f0c8272be0fb83 (diff) | |
download | busybox-w32-23ffb6a4a2a01fe41abe4e42d46fa16bdc2603fd.tar.gz busybox-w32-23ffb6a4a2a01fe41abe4e42d46fa16bdc2603fd.tar.bz2 busybox-w32-23ffb6a4a2a01fe41abe4e42d46fa16bdc2603fd.zip |
tar: compat: handle tarballs with only one zero block at the end
-rw-r--r-- | archival/libunarchive/get_header_tar.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index 274bd4607..7493d910e 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c | |||
@@ -90,7 +90,15 @@ char get_header_tar(archive_handle_t *archive_handle) | |||
90 | 90 | ||
91 | again_after_align: | 91 | again_after_align: |
92 | 92 | ||
93 | xread(archive_handle->src_fd, &tar, 512); | 93 | i = full_read(archive_handle->src_fd, &tar, 512); |
94 | /* if GNU tar sees EOF in above read, it says: | ||
95 | * "tar: A lone zero block at N", where N = kilobyte | ||
96 | * where EOF was met (not EOF block, actual EOF!), | ||
97 | * and tar will exit with error code 0! Mimic exit(0): */ | ||
98 | if (i == 0) | ||
99 | xfunc_error_retval = 0; | ||
100 | if (i != 512) | ||
101 | bb_error_msg_and_die("short read"); | ||
94 | archive_handle->offset += 512; | 102 | archive_handle->offset += 512; |
95 | 103 | ||
96 | /* If there is no filename its an empty header */ | 104 | /* If there is no filename its an empty header */ |