summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/dpkg_deb.c17
-rw-r--r--archival/libunarchive/filter_accept_list_reassign.c1
-rw-r--r--archival/libunarchive/get_header_tar_bz2.c3
-rw-r--r--archival/libunarchive/get_header_tar_gz.c3
-rw-r--r--archival/tar.c16
5 files changed, 7 insertions, 33 deletions
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index c467395..7ce637e 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -29,13 +29,6 @@ extern int dpkg_deb_main(int argc, char **argv)
#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
const llist_t *control_tar_llist = NULL;
#endif
-#ifndef CONFIG_AR
- char magic[7];
-#endif
-
- /* a .deb file is an ar archive that contain three files,
- * data.tar.gz, control.tar.gz and debian
- */
/* Setup the tar archive handle */
tar_archive = init_handle();
@@ -104,17 +97,7 @@ extern int dpkg_deb_main(int argc, char **argv)
mkdir(argv[optind], 0777);
chdir(argv[optind]);
-#ifdef CONFIG_AR
unpack_ar_archive(ar_archive);
-#else
- xread_all(ar_archive->src_fd, magic, 7);
- if (strncmp(magic, "!<arch>", 7) != 0) {
- error_msg_and_die("Invalid ar magic");
- }
- ar_archive->offset += 7;
-
- while (get_header_ar(ar_archive) == EXIT_SUCCESS);
-#endif
/* Cleanup */
close (ar_archive->src_fd);
diff --git a/archival/libunarchive/filter_accept_list_reassign.c b/archival/libunarchive/filter_accept_list_reassign.c
index fa294c7..d9bee79 100644
--- a/archival/libunarchive/filter_accept_list_reassign.c
+++ b/archival/libunarchive/filter_accept_list_reassign.c
@@ -48,7 +48,6 @@ extern char filter_accept_list_reassign(archive_handle_t *archive_handle)
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
if (strcmp(name_ptr, ".bz2") == 0) {
archive_handle->sub_archive->read = read_bz2;
-// BZ2_bzReadOpen(archive_handle->sub_archive->src_fd, NULL, 0);
BZ2_bzReadOpen(archive_handle->src_fd, NULL, 0);
archive_handle->action_data_subarchive = get_header_tar;
return(EXIT_SUCCESS);
diff --git a/archival/libunarchive/get_header_tar_bz2.c b/archival/libunarchive/get_header_tar_bz2.c
index 4e47166..b49ccae 100644
--- a/archival/libunarchive/get_header_tar_bz2.c
+++ b/archival/libunarchive/get_header_tar_bz2.c
@@ -27,6 +27,9 @@ extern char get_header_tar_bz2(archive_handle_t *archive_handle)
{
BZ2_bzReadOpen(archive_handle->src_fd, NULL, 0);
+ archive_handle->read = read_bz2;
+ archive_handle->seek = seek_by_char;
+
archive_handle->offset = 0;
while (get_header_tar(archive_handle) == EXIT_SUCCESS);
diff --git a/archival/libunarchive/get_header_tar_gz.c b/archival/libunarchive/get_header_tar_gz.c
index f0d4b13..f77b775 100644
--- a/archival/libunarchive/get_header_tar_gz.c
+++ b/archival/libunarchive/get_header_tar_gz.c
@@ -28,8 +28,9 @@ extern char get_header_tar_gz(archive_handle_t *archive_handle)
int fd_pipe[2];
int pid;
unsigned char magic[2];
-
+
/* Cant lseek over pipe's */
+ archive_handle->read = read;
archive_handle->seek = seek_by_char;
archive_xread_all(archive_handle, &magic, 2);
diff --git a/archival/tar.c b/archival/tar.c
index 01ec90c..f9711f8 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -685,7 +685,7 @@ int tar_main(int argc, char **argv)
#endif
#ifdef CONFIG_FEATURE_TAR_BZIP2
case 'j':
- tar_handle->read = read_bz2;
+ get_header_ptr = get_header_tar_bz2;
break;
#endif
default:
@@ -738,21 +738,9 @@ int tar_main(int argc, char **argv)
tar_handle->src_fd = fileno(stdin);
tar_handle->seek = seek_by_char;
} else {
- tar_handle->seek = seek_by_jump;
tar_handle->src_fd = xopen(tar_filename, O_RDONLY);
}
-#ifdef CONFIG_FEATURE_TAR_GZIP
- if (get_header_ptr == get_header_tar_gz) {
- get_header_tar_gz(tar_handle);
- } else
-#endif /* CONFIG_FEATURE_TAR_GZIP */
-#ifdef CONFIG_FEATURE_TAR_BZIP2
- if (tar_handle->read == read_bz2) {
- get_header_tar_bz2(tar_handle);
- } else
-#endif /* CONFIG_FEATURE_TAR_BZIP2 */
-
- while (get_header_tar(tar_handle) == EXIT_SUCCESS);
+ while (get_header_ptr(tar_handle) == EXIT_SUCCESS);
/* Ckeck that every file that should have been extracted was */
while (tar_handle->accept) {