aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
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)
ar_handle->sub_archive = tar_handle;
}
+static void FAST_FUNC data_extract_to_buffer(archive_handle_t *archive_handle)
+{
+ unsigned size = archive_handle->file_header->size;
+
+ archive_handle->ah_buffer = xzalloc(size + 1);
+ xread(archive_handle->src_fd, archive_handle->ah_buffer, size);
+}
+
static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, llist_t *myaccept)
{
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
unpack_ar_archive(ar_handle);
close(ar_handle->src_fd);
- return ar_handle->sub_archive->buffer;
+ return ar_handle->sub_archive->ah_buffer;
}
static 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)
name_ptr += strspn(name_ptr, "./");
if (name_ptr[0] != '\0') {
- archive_handle->file_header->name = xasprintf("%s%s", archive_handle->buffer, name_ptr);
+ archive_handle->file_header->name = xasprintf("%s%s", archive_handle->ah_buffer, name_ptr);
data_extract_all(archive_handle);
}
}
@@ -1530,7 +1538,7 @@ static void unpack_package(deb_file_t *deb_file)
archive_handle->sub_archive->accept = accept_list;
archive_handle->sub_archive->filter = filter_accept_list;
archive_handle->sub_archive->action_data = data_extract_all_prefix;
- archive_handle->sub_archive->buffer = info_prefix;
+ archive_handle->sub_archive->ah_buffer = info_prefix;
archive_handle->sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD;
unpack_ar_archive(archive_handle);
@@ -1541,7 +1549,7 @@ static void unpack_package(deb_file_t *deb_file)
archive_handle = init_archive_deb_ar(deb_file->filename);
init_archive_deb_data(archive_handle);
archive_handle->sub_archive->action_data = data_extract_all_prefix;
- archive_handle->sub_archive->buffer = (char*)"/"; /* huh? */
+ archive_handle->sub_archive->ah_buffer = (char*)"/"; /* huh? */
archive_handle->sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD;
unpack_ar_archive(archive_handle);
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:= \
data_skip.o \
data_extract_all.o \
data_extract_to_stdout.o \
- data_extract_to_buffer.o \
\
filter_accept_all.o \
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 @@
-/* vi: set sw=4 ts=4: */
-/*
- * Copyright 2002 Glenn McGrath
- *
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
- */
-
-#include "libbb.h"
-#include "unarchive.h"
-
-void FAST_FUNC data_extract_to_buffer(archive_handle_t *archive_handle)
-{
- unsigned int size = archive_handle->file_header->size;
-
- archive_handle->buffer = xzalloc(size + 1);
- xread(archive_handle->src_fd, archive_handle->buffer, size);
-}
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)
/* wait failed?! I'm confused... */
return;
- if (WIFEXITED(status) && WEXITSTATUS(status)==0)
+ if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
/* child exited with 0 */
return;
/* Cannot happen?
@@ -748,15 +748,16 @@ enum {
IF_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,)
IF_FEATURE_SEAMLESS_GZ( OPTBIT_GZIP ,)
IF_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,) // 16th bit
+#if ENABLE_FEATURE_TAR_LONG_OPTIONS
OPTBIT_NUMERIC_OWNER,
- OPTBIT_NOPRESERVE_OWNER,
OPTBIT_NOPRESERVE_PERM,
+#endif
OPT_TEST = 1 << 0, // t
OPT_EXTRACT = 1 << 1, // x
OPT_BASEDIR = 1 << 2, // C
OPT_TARNAME = 1 << 3, // f
OPT_2STDOUT = 1 << 4, // O
- OPT_NOPRESERVE_OWNER = 1 << 5, // no-same-owner
+ OPT_NOPRESERVE_OWNER = 1 << 5, // o == no-same-owner
OPT_P = 1 << 6, // p
OPT_VERBOSE = 1 << 7, // v
OPT_KEEP_OLD = 1 << 8, // k
@@ -768,8 +769,8 @@ enum {
OPT_EXCLUDE_FROM = IF_FEATURE_TAR_FROM( (1 << OPTBIT_EXCLUDE_FROM)) + 0, // X
OPT_GZIP = IF_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z
OPT_COMPRESS = IF_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z
- OPT_NUMERIC_OWNER = 1 << OPTBIT_NUMERIC_OWNER,
- OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, // no-same-permissions
+ OPT_NUMERIC_OWNER = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NUMERIC_OWNER )) + 0, // numeric-owner
+ OPT_NOPRESERVE_PERM = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NOPRESERVE_PERM)) + 0, // no-same-permissions
};
#if ENABLE_FEATURE_TAR_LONG_OPTIONS
static const char tar_longopts[] ALIGN1 =
@@ -810,8 +811,7 @@ static const char tar_longopts[] ALIGN1 =
/* do not restore mode */
"no-same-permissions\0" No_argument "\xfe"
/* --exclude takes next bit position in option mask, */
- /* therefore we have to either put it _after_ --no-same-perm */
- /* or add OPT[BIT]_EXCLUDE before OPT[BIT]_NOPRESERVE_OWNER */
+ /* therefore we have to put it _after_ --no-same-permissions */
# if ENABLE_FEATURE_TAR_FROM
"exclude\0" Required_argument "\xff"
# endif