aboutsummaryrefslogtreecommitdiff
path: root/archival/libunarchive
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-11-24 14:53:18 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-11-24 14:53:18 +0000
commitcf30cc82a343802b601f01ae153916887f11eb7b (patch)
treedd5af380364efe67c7bd302d6c1c6d70f303f959 /archival/libunarchive
parent376ce1e775a97a01f1c454497fbe34d326043328 (diff)
downloadbusybox-cf30cc82a343802b601f01ae153916887f11eb7b.tar.gz
header_verbose_list: stop truncating file size in listing
Diffstat (limited to 'archival/libunarchive')
-rw-r--r--archival/libunarchive/get_header_tar.c41
-rw-r--r--archival/libunarchive/header_verbose_list.c7
2 files changed, 23 insertions, 25 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index b5cae9f12..68f7b2b9b 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -111,25 +111,6 @@ char get_header_tar(archive_handle_t *archive_handle)
bb_error_msg_and_die("invalid tar header checksum");
}
-#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
- if (longname) {
- file_header->name = longname;
- longname = NULL;
- }
- else if (linkname) {
- file_header->name = linkname;
- linkname = NULL;
- } else
-#endif
- {
- file_header->name = xstrndup(tar.name, sizeof(tar.name));
- if (tar.prefix[0]) {
- char *temp = file_header->name;
- file_header->name = concat_path_file(tar.prefix, temp);
- free(temp);
- }
- }
-
/* getOctal trashes subsequent field, therefore we call it
* on fields in reverse order */
#define GET_OCTAL(a) getOctal((a), sizeof(a))
@@ -148,6 +129,24 @@ char get_header_tar(archive_handle_t *archive_handle)
file_header->mode = 07777 & GET_OCTAL(tar.mode);
#undef GET_OCTAL
+#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
+ if (longname) {
+ file_header->name = longname;
+ longname = NULL;
+ }
+ else if (linkname) {
+ file_header->name = linkname;
+ linkname = NULL;
+ } else
+#endif
+ { /* we trash mode[0] here, it's ok */
+ tar.name[sizeof(tar.name)] = '\0';
+ if (tar.prefix[0])
+ file_header->name = concat_path_file(tar.prefix, tar.name);
+ else
+ file_header->name = xstrdup(tar.name);
+ }
+
/* Set bits 12-15 of the files mode */
switch (tar.typeflag) {
/* busybox identifies hard links as being regular files with 0 size and a link name */
@@ -209,10 +208,12 @@ char get_header_tar(archive_handle_t *archive_handle)
/* Strip trailing '/' in directories */
/* Must be done after mode is set as '/' is used to check if its a directory */
cp = last_char_is(file_header->name, '/');
- if (cp) *cp = '\0';
if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) {
archive_handle->action_header(archive_handle->file_header);
+ /* Note that we kill the '/' only after action_header() */
+ /* (like GNU tar 1.15.1: verbose mode outputs "dir/dir/") */
+ if (cp) *cp = '\0';
archive_handle->flags |= ARCHIVE_EXTRACT_QUIET;
archive_handle->action_data(archive_handle);
llist_add_to(&(archive_handle->passed), file_header->name);
diff --git a/archival/libunarchive/header_verbose_list.c b/archival/libunarchive/header_verbose_list.c
index 130b6a268..7b97e524c 100644
--- a/archival/libunarchive/header_verbose_list.c
+++ b/archival/libunarchive/header_verbose_list.c
@@ -3,9 +3,6 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
#include "libbb.h"
#include "unarchive.h"
@@ -13,11 +10,11 @@ void header_verbose_list(const file_header_t *file_header)
{
struct tm *mtime = localtime(&(file_header->mtime));
- printf("%s %d/%d%10u %4u-%02u-%02u %02u:%02u:%02u %s",
+ printf("%s %d/%d %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
bb_mode_string(file_header->mode),
file_header->uid,
file_header->gid,
- (unsigned int) file_header->size,
+ file_header->size,
1900 + mtime->tm_year,
1 + mtime->tm_mon,
mtime->tm_mday,