aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/libarchive/get_header_ar.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/archival/libarchive/get_header_ar.c b/archival/libarchive/get_header_ar.c
index a97970630..adcde46d5 100644
--- a/archival/libarchive/get_header_ar.c
+++ b/archival/libarchive/get_header_ar.c
@@ -34,10 +34,6 @@ char FAST_FUNC get_header_ar(archive_handle_t *archive_handle)
34 char raw[60]; 34 char raw[60];
35 struct ar_header formatted; 35 struct ar_header formatted;
36 } ar; 36 } ar;
37#if ENABLE_FEATURE_AR_LONG_FILENAMES
38 static char *ar_long_names;
39 static unsigned ar_long_name_size;
40#endif
41 37
42 /* dont use xread as we want to handle the error ourself */ 38 /* dont use xread as we want to handle the error ourself */
43 if (read(archive_handle->src_fd, ar.raw, 60) != 60) { 39 if (read(archive_handle->src_fd, ar.raw, 60) != 60) {
@@ -81,10 +77,10 @@ char FAST_FUNC get_header_ar(archive_handle_t *archive_handle)
81 * stores long filename for multiple entries, they are stored 77 * stores long filename for multiple entries, they are stored
82 * in static variable long_names for use in future entries 78 * in static variable long_names for use in future entries
83 */ 79 */
84 ar_long_name_size = size; 80 archive_handle->ar__long_name_size = size;
85 free(ar_long_names); 81 free(archive_handle->ar__long_names);
86 ar_long_names = xzalloc(size + 1); 82 archive_handle->ar__long_names = xzalloc(size + 1);
87 xread(archive_handle->src_fd, ar_long_names, size); 83 xread(archive_handle->src_fd, archive_handle->ar__long_names, size);
88 archive_handle->offset += size; 84 archive_handle->offset += size;
89 /* Return next header */ 85 /* Return next header */
90 return get_header_ar(archive_handle); 86 return get_header_ar(archive_handle);
@@ -107,13 +103,13 @@ char FAST_FUNC get_header_ar(archive_handle_t *archive_handle)
107 unsigned long_offset; 103 unsigned long_offset;
108 104
109 /* The number after the '/' indicates the offset in the ar data section 105 /* The number after the '/' indicates the offset in the ar data section
110 * (saved in ar_long_names) that contains the real filename */ 106 * (saved in ar__long_names) that contains the real filename */
111 long_offset = read_num(&ar.formatted.name[1], 10, 107 long_offset = read_num(&ar.formatted.name[1], 10,
112 sizeof(ar.formatted.name) - 1); 108 sizeof(ar.formatted.name) - 1);
113 if (long_offset >= ar_long_name_size) { 109 if (long_offset >= archive_handle->ar__long_name_size) {
114 bb_error_msg_and_die("can't resolve long filename"); 110 bb_error_msg_and_die("can't resolve long filename");
115 } 111 }
116 typed->name = xstrdup(ar_long_names + long_offset); 112 typed->name = xstrdup(archive_handle->ar__long_names + long_offset);
117 } else 113 } else
118#endif 114#endif
119 { 115 {