summaryrefslogtreecommitdiff
path: root/archival/libunarchive
diff options
context:
space:
mode:
authorDenys Vlasenko2010-06-26 18:21:36 +0200
committerDenys Vlasenko2010-06-26 18:21:36 +0200
commit52827e3ebcd80f634f990030ee697254a0ae517d (patch)
tree61cb4b3f65587301b1f2774a42c228d2f221d24e /archival/libunarchive
parentd0a8a0d31243f2ac798531ced2cca45ddf1fea42 (diff)
downloadbusybox-52827e3ebcd80f634f990030ee697254a0ae517d.zip
busybox-52827e3ebcd80f634f990030ee697254a0ae517d.tar.gz
*: tar-related cleanups: move struct to unarchive.h; move help to tar.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/libunarchive')
-rw-r--r--archival/libunarchive/get_header_tar.c40
1 files changed, 8 insertions, 32 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index fcddcb8..01c1043 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -118,34 +118,10 @@ static char *get_selinux_sctx_from_pax_hdr(archive_handle_t *archive_handle, uns
}
#endif
-void BUG_tar_header_size(void);
char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
{
file_header_t *file_header = archive_handle->file_header;
- struct {
- /* ustar header, Posix 1003.1 */
- char name[100]; /* 0-99 */
- char mode[8]; /* 100-107 */
- char uid[8]; /* 108-115 */
- char gid[8]; /* 116-123 */
- char size[12]; /* 124-135 */
- char mtime[12]; /* 136-147 */
- char chksum[8]; /* 148-155 */
- char typeflag; /* 156-156 */
- char linkname[100]; /* 157-256 */
- /* POSIX: "ustar" NUL "00" */
- /* GNU tar: "ustar " NUL */
- /* Normally it's defined as magic[6] followed by
- * version[2], but we put them together to simplify code
- */
- char magic[8]; /* 257-264 */
- char uname[32]; /* 265-296 */
- char gname[32]; /* 297-328 */
- char devmajor[8]; /* 329-336 */
- char devminor[8]; /* 337-344 */
- char prefix[155]; /* 345-499 */
- char padding[12]; /* 500-512 */
- } tar;
+ struct tar_header_t tar;
char *cp;
int i, sum_u, sum;
#if ENABLE_FEATURE_TAR_OLDSUN_COMPATIBILITY
@@ -162,9 +138,6 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
# define p_linkname 0
#endif
- if (sizeof(tar) != 512)
- BUG_tar_header_size();
-
#if ENABLE_FEATURE_TAR_GNU_EXTENSIONS || ENABLE_FEATURE_TAR_SELINUX
again:
#endif
@@ -230,18 +203,21 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
* we can switch to get_header_tar_gz/bz2/lzma().
* Needs seekable fd. I wish recv(MSG_PEEK) works
* on any fd... */
-#if ENABLE_FEATURE_SEAMLESS_GZ
+# if ENABLE_FEATURE_SEAMLESS_GZ
if (tar.name[0] == 0x1f && tar.name[1] == (char)0x8b) { /* gzip */
get_header_ptr = get_header_tar_gz;
} else
-#endif
-#if ENABLE_FEATURE_SEAMLESS_BZ2
+# endif
+# if ENABLE_FEATURE_SEAMLESS_BZ2
if (tar.name[0] == 'B' && tar.name[1] == 'Z'
&& tar.name[2] == 'h' && isdigit(tar.name[3])
) { /* bzip2 */
get_header_ptr = get_header_tar_bz2;
} else
-#endif
+# endif
+# if ENABLE_FEATURE_SEAMLESS_XZ
+ //TODO
+# endif
goto err;
/* Two different causes for lseek() != 0:
* unseekable fd (would like to support that too, but...),