aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-12-16 22:46:01 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-12-16 22:46:01 +0100
commit425ad9c93b2736a0ebfbba6267bc1ad56c49d156 (patch)
treea927ce59974a130f40ac93537b5dacaed668e77b /archival
parentdbc6a7a8fd33c79037c7f2894c24f271b714e3bc (diff)
downloadbusybox-w32-425ad9c93b2736a0ebfbba6267bc1ad56c49d156.tar.gz
busybox-w32-425ad9c93b2736a0ebfbba6267bc1ad56c49d156.tar.bz2
busybox-w32-425ad9c93b2736a0ebfbba6267bc1ad56c49d156.zip
libunarchive: move dpkg-specific things into dpkg.c. 0 byte size differences
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival')
-rw-r--r--archival/dpkg.c16
-rw-r--r--archival/libunarchive/Kbuild1
-rw-r--r--archival/libunarchive/data_extract_to_buffer.c17
-rw-r--r--archival/tar.c14
4 files changed, 19 insertions, 29 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c
index 451c6fa32..2e24541bf 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -1469,6 +1469,14 @@ static void init_archive_deb_data(archive_handle_t *ar_handle)
1469 ar_handle->sub_archive = tar_handle; 1469 ar_handle->sub_archive = tar_handle;
1470} 1470}
1471 1471
1472static void FAST_FUNC data_extract_to_buffer(archive_handle_t *archive_handle)
1473{
1474 unsigned size = archive_handle->file_header->size;
1475
1476 archive_handle->ah_buffer = xzalloc(size + 1);
1477 xread(archive_handle->src_fd, archive_handle->ah_buffer, size);
1478}
1479
1472static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, llist_t *myaccept) 1480static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, llist_t *myaccept)
1473{ 1481{
1474 ar_handle->sub_archive->action_data = data_extract_to_buffer; 1482 ar_handle->sub_archive->action_data = data_extract_to_buffer;
@@ -1478,7 +1486,7 @@ static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, lli
1478 unpack_ar_archive(ar_handle); 1486 unpack_ar_archive(ar_handle);
1479 close(ar_handle->src_fd); 1487 close(ar_handle->src_fd);
1480 1488
1481 return ar_handle->sub_archive->buffer; 1489 return ar_handle->sub_archive->ah_buffer;
1482} 1490}
1483 1491
1484static void FAST_FUNC data_extract_all_prefix(archive_handle_t *archive_handle) 1492static void FAST_FUNC data_extract_all_prefix(archive_handle_t *archive_handle)
@@ -1487,7 +1495,7 @@ static void FAST_FUNC data_extract_all_prefix(archive_handle_t *archive_handle)
1487 1495
1488 name_ptr += strspn(name_ptr, "./"); 1496 name_ptr += strspn(name_ptr, "./");
1489 if (name_ptr[0] != '\0') { 1497 if (name_ptr[0] != '\0') {
1490 archive_handle->file_header->name = xasprintf("%s%s", archive_handle->buffer, name_ptr); 1498 archive_handle->file_header->name = xasprintf("%s%s", archive_handle->ah_buffer, name_ptr);
1491 data_extract_all(archive_handle); 1499 data_extract_all(archive_handle);
1492 } 1500 }
1493} 1501}
@@ -1530,7 +1538,7 @@ static void unpack_package(deb_file_t *deb_file)
1530 archive_handle->sub_archive->accept = accept_list; 1538 archive_handle->sub_archive->accept = accept_list;
1531 archive_handle->sub_archive->filter = filter_accept_list; 1539 archive_handle->sub_archive->filter = filter_accept_list;
1532 archive_handle->sub_archive->action_data = data_extract_all_prefix; 1540 archive_handle->sub_archive->action_data = data_extract_all_prefix;
1533 archive_handle->sub_archive->buffer = info_prefix; 1541 archive_handle->sub_archive->ah_buffer = info_prefix;
1534 archive_handle->sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD; 1542 archive_handle->sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD;
1535 unpack_ar_archive(archive_handle); 1543 unpack_ar_archive(archive_handle);
1536 1544
@@ -1541,7 +1549,7 @@ static void unpack_package(deb_file_t *deb_file)
1541 archive_handle = init_archive_deb_ar(deb_file->filename); 1549 archive_handle = init_archive_deb_ar(deb_file->filename);
1542 init_archive_deb_data(archive_handle); 1550 init_archive_deb_data(archive_handle);
1543 archive_handle->sub_archive->action_data = data_extract_all_prefix; 1551 archive_handle->sub_archive->action_data = data_extract_all_prefix;
1544 archive_handle->sub_archive->buffer = (char*)"/"; /* huh? */ 1552 archive_handle->sub_archive->ah_buffer = (char*)"/"; /* huh? */
1545 archive_handle->sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD; 1553 archive_handle->sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD;
1546 unpack_ar_archive(archive_handle); 1554 unpack_ar_archive(archive_handle);
1547 1555
diff --git a/archival/libunarchive/Kbuild b/archival/libunarchive/Kbuild
index 4bb81ce26..11d23b25f 100644
--- a/archival/libunarchive/Kbuild
+++ b/archival/libunarchive/Kbuild
@@ -11,7 +11,6 @@ COMMON_FILES:= \
11 data_skip.o \ 11 data_skip.o \
12 data_extract_all.o \ 12 data_extract_all.o \
13 data_extract_to_stdout.o \ 13 data_extract_to_stdout.o \
14 data_extract_to_buffer.o \
15\ 14\
16 filter_accept_all.o \ 15 filter_accept_all.o \
17 filter_accept_list.o \ 16 filter_accept_list.o \
diff --git a/archival/libunarchive/data_extract_to_buffer.c b/archival/libunarchive/data_extract_to_buffer.c
deleted file mode 100644
index 1d74e0335..000000000
--- a/archival/libunarchive/data_extract_to_buffer.c
+++ /dev/null
@@ -1,17 +0,0 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * Copyright 2002 Glenn McGrath
4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
6 */
7
8#include "libbb.h"
9#include "unarchive.h"
10
11void FAST_FUNC data_extract_to_buffer(archive_handle_t *archive_handle)
12{
13 unsigned int size = archive_handle->file_header->size;
14
15 archive_handle->buffer = xzalloc(size + 1);
16 xread(archive_handle->src_fd, archive_handle->buffer, size);
17}
diff --git a/archival/tar.c b/archival/tar.c
index d6c44a7b7..7ec101d31 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -729,7 +729,7 @@ static void handle_SIGCHLD(int status)
729 /* wait failed?! I'm confused... */ 729 /* wait failed?! I'm confused... */
730 return; 730 return;
731 731
732 if (WIFEXITED(status) && WEXITSTATUS(status)==0) 732 if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
733 /* child exited with 0 */ 733 /* child exited with 0 */
734 return; 734 return;
735 /* Cannot happen? 735 /* Cannot happen?
@@ -748,15 +748,16 @@ enum {
748 IF_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,) 748 IF_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,)
749 IF_FEATURE_SEAMLESS_GZ( OPTBIT_GZIP ,) 749 IF_FEATURE_SEAMLESS_GZ( OPTBIT_GZIP ,)
750 IF_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,) // 16th bit 750 IF_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,) // 16th bit
751#if ENABLE_FEATURE_TAR_LONG_OPTIONS
751 OPTBIT_NUMERIC_OWNER, 752 OPTBIT_NUMERIC_OWNER,
752 OPTBIT_NOPRESERVE_OWNER,
753 OPTBIT_NOPRESERVE_PERM, 753 OPTBIT_NOPRESERVE_PERM,
754#endif
754 OPT_TEST = 1 << 0, // t 755 OPT_TEST = 1 << 0, // t
755 OPT_EXTRACT = 1 << 1, // x 756 OPT_EXTRACT = 1 << 1, // x
756 OPT_BASEDIR = 1 << 2, // C 757 OPT_BASEDIR = 1 << 2, // C
757 OPT_TARNAME = 1 << 3, // f 758 OPT_TARNAME = 1 << 3, // f
758 OPT_2STDOUT = 1 << 4, // O 759 OPT_2STDOUT = 1 << 4, // O
759 OPT_NOPRESERVE_OWNER = 1 << 5, // no-same-owner 760 OPT_NOPRESERVE_OWNER = 1 << 5, // o == no-same-owner
760 OPT_P = 1 << 6, // p 761 OPT_P = 1 << 6, // p
761 OPT_VERBOSE = 1 << 7, // v 762 OPT_VERBOSE = 1 << 7, // v
762 OPT_KEEP_OLD = 1 << 8, // k 763 OPT_KEEP_OLD = 1 << 8, // k
@@ -768,8 +769,8 @@ enum {
768 OPT_EXCLUDE_FROM = IF_FEATURE_TAR_FROM( (1 << OPTBIT_EXCLUDE_FROM)) + 0, // X 769 OPT_EXCLUDE_FROM = IF_FEATURE_TAR_FROM( (1 << OPTBIT_EXCLUDE_FROM)) + 0, // X
769 OPT_GZIP = IF_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z 770 OPT_GZIP = IF_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z
770 OPT_COMPRESS = IF_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z 771 OPT_COMPRESS = IF_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z
771 OPT_NUMERIC_OWNER = 1 << OPTBIT_NUMERIC_OWNER, 772 OPT_NUMERIC_OWNER = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NUMERIC_OWNER )) + 0, // numeric-owner
772 OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, // no-same-permissions 773 OPT_NOPRESERVE_PERM = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NOPRESERVE_PERM)) + 0, // no-same-permissions
773}; 774};
774#if ENABLE_FEATURE_TAR_LONG_OPTIONS 775#if ENABLE_FEATURE_TAR_LONG_OPTIONS
775static const char tar_longopts[] ALIGN1 = 776static const char tar_longopts[] ALIGN1 =
@@ -810,8 +811,7 @@ static const char tar_longopts[] ALIGN1 =
810 /* do not restore mode */ 811 /* do not restore mode */
811 "no-same-permissions\0" No_argument "\xfe" 812 "no-same-permissions\0" No_argument "\xfe"
812 /* --exclude takes next bit position in option mask, */ 813 /* --exclude takes next bit position in option mask, */
813 /* therefore we have to either put it _after_ --no-same-perm */ 814 /* therefore we have to put it _after_ --no-same-permissions */
814 /* or add OPT[BIT]_EXCLUDE before OPT[BIT]_NOPRESERVE_OWNER */
815# if ENABLE_FEATURE_TAR_FROM 815# if ENABLE_FEATURE_TAR_FROM
816 "exclude\0" Required_argument "\xff" 816 "exclude\0" Required_argument "\xff"
817# endif 817# endif