aboutsummaryrefslogtreecommitdiff
path: root/archival/libunarchive/get_header_ar.c
diff options
context:
space:
mode:
authorAlexander Shishkin <virtuoso@slind.org>2010-03-15 15:38:09 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-03-15 15:38:09 +0100
commit535584c750820dd6c36011697f9ef89fe0a0698c (patch)
tree6c682a7a6ca7d740529201c759fa4e64d9622797 /archival/libunarchive/get_header_ar.c
parent814da220a5d451c036c9871094253366372676e0 (diff)
downloadbusybox-535584c750820dd6c36011697f9ef89fe0a0698c.tar.gz
ar: add archive creation support
function old new delta ar_main 184 542 +358 output_ar_header - 166 +166 copy_data - 54 +54 filter_replaceable - 19 +19 get_header_ar 409 414 +5 header_verbose_list_ar 85 88 +3 static.msg_unsupported_err 28 - -28 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 3/0 up/down: 605/-28) Total: 577 bytes Signed-off-by: Alexander Shishkin <virtuoso@slind.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/libunarchive/get_header_ar.c')
-rw-r--r--archival/libunarchive/get_header_ar.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c
index 2f38279cc..dbc5ec004 100644
--- a/archival/libunarchive/get_header_ar.c
+++ b/archival/libunarchive/get_header_ar.c
@@ -6,6 +6,7 @@
#include "libbb.h"
#include "unarchive.h"
+#include "ar.h"
static unsigned read_num(const char *str, int base)
{
@@ -23,15 +24,7 @@ char FAST_FUNC get_header_ar(archive_handle_t *archive_handle)
unsigned size;
union {
char raw[60];
- struct {
- char name[16];
- char date[12];
- char uid[6];
- char gid[6];
- char mode[8];
- char size[10];
- char magic[2];
- } formatted;
+ struct ar_header formatted;
} ar;
#if ENABLE_FEATURE_AR_LONG_FILENAMES
static char *ar_long_names;
@@ -55,13 +48,13 @@ char FAST_FUNC get_header_ar(archive_handle_t *archive_handle)
}
archive_handle->offset += 60;
- /* align the headers based on the header magic */
if (ar.formatted.magic[0] != '`' || ar.formatted.magic[1] != '\n')
bb_error_msg_and_die("invalid ar header");
/* FIXME: more thorough routine would be in order here
* (we have something like that in tar)
* but for now we are lax. */
+ ar.formatted.magic[0] = '\0'; /* else 4G-2 file will have size="4294967294`\n..." */
typed->size = size = read_num(ar.formatted.size, 10);
/* special filenames have '/' as the first character */