aboutsummaryrefslogtreecommitdiff
path: root/archival/libarchive
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-06-19 18:15:33 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-06-19 18:15:33 +0200
commit015db5800ca7c6dd2d201eacb2951e72e6782b30 (patch)
tree0fe9b90c782f2ac831f30793e384b07bd690b3b3 /archival/libarchive
parentce824aecf216536beed00d7817a614ffb8572239 (diff)
downloadbusybox-w32-015db5800ca7c6dd2d201eacb2951e72e6782b30.tar.gz
busybox-w32-015db5800ca7c6dd2d201eacb2951e72e6782b30.tar.bz2
busybox-w32-015db5800ca7c6dd2d201eacb2951e72e6782b30.zip
randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/libarchive')
-rw-r--r--archival/libarchive/get_header_tar.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c
index ac2be726f..ea91a883e 100644
--- a/archival/libarchive/get_header_tar.c
+++ b/archival/libarchive/get_header_tar.c
@@ -60,13 +60,21 @@ static unsigned long long getOctal(char *str, int len)
60} 60}
61#define GET_OCTAL(a) getOctal((a), sizeof(a)) 61#define GET_OCTAL(a) getOctal((a), sizeof(a))
62 62
63#define TAR_EXTD (ENABLE_FEATURE_TAR_GNU_EXTENSIONS || ENABLE_FEATURE_TAR_SELINUX)
64#if !TAR_EXTD
65#define process_pax_hdr(archive_handle, sz, global) \
66 process_pax_hdr(archive_handle, sz)
67#endif
63/* "global" is 0 or 1 */ 68/* "global" is 0 or 1 */
64static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int global) 69static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int global)
65{ 70{
71#if !TAR_EXTD
72 unsigned blk_sz = (sz + 511) & (~511);
73 seek_by_read(archive_handle->src_fd, blk_sz);
74#else
75 unsigned blk_sz = (sz + 511) & (~511);
66 char *buf, *p; 76 char *buf, *p;
67 unsigned blk_sz;
68 77
69 blk_sz = (sz + 511) & (~511);
70 p = buf = xmalloc(blk_sz + 1); 78 p = buf = xmalloc(blk_sz + 1);
71 xread(archive_handle->src_fd, buf, blk_sz); 79 xread(archive_handle->src_fd, buf, blk_sz);
72 archive_handle->offset += blk_sz; 80 archive_handle->offset += blk_sz;
@@ -104,30 +112,31 @@ static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int g
104 p[-1] = '\0'; 112 p[-1] = '\0';
105 value = end + 1; 113 value = end + 1;
106 114
107#if ENABLE_FEATURE_TAR_GNU_EXTENSIONS 115# if ENABLE_FEATURE_TAR_GNU_EXTENSIONS
108 if (!global && is_prefixed_with(value, "path=")) { 116 if (!global && is_prefixed_with(value, "path=")) {
109 value += sizeof("path=") - 1; 117 value += sizeof("path=") - 1;
110 free(archive_handle->tar__longname); 118 free(archive_handle->tar__longname);
111 archive_handle->tar__longname = xstrdup(value); 119 archive_handle->tar__longname = xstrdup(value);
112 continue; 120 continue;
113 } 121 }
114#endif 122# endif
115 123
116#if ENABLE_FEATURE_TAR_SELINUX 124# if ENABLE_FEATURE_TAR_SELINUX
117 /* Scan for SELinux contexts, via "RHT.security.selinux" keyword. 125 /* Scan for SELinux contexts, via "RHT.security.selinux" keyword.
118 * This is what Red Hat's patched version of tar uses. 126 * This is what Red Hat's patched version of tar uses.
119 */ 127 */
120# define SELINUX_CONTEXT_KEYWORD "RHT.security.selinux" 128# define SELINUX_CONTEXT_KEYWORD "RHT.security.selinux"
121 if (is_prefixed_with(value, SELINUX_CONTEXT_KEYWORD"=")) { 129 if (is_prefixed_with(value, SELINUX_CONTEXT_KEYWORD"=")) {
122 value += sizeof(SELINUX_CONTEXT_KEYWORD"=") - 1; 130 value += sizeof(SELINUX_CONTEXT_KEYWORD"=") - 1;
123 free(archive_handle->tar__sctx[global]); 131 free(archive_handle->tar__sctx[global]);
124 archive_handle->tar__sctx[global] = xstrdup(value); 132 archive_handle->tar__sctx[global] = xstrdup(value);
125 continue; 133 continue;
126 } 134 }
127#endif 135# endif
128 } 136 }
129 137
130 free(buf); 138 free(buf);
139#endif
131} 140}
132 141
133char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) 142char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)