Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/archival/libarchive
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- Location:
- branches/3.2/mindi-busybox/archival/libarchive
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/archival/libarchive/Kbuild.src
r2725 r3232 29 29 30 30 DPKG_FILES:= \ 31 unpack_ar_archive.o \ 32 filter_accept_list_reassign.o \ 31 33 get_header_ar.o \ 32 unpack_ar_archive.o \33 34 get_header_tar.o \ 34 filter_accept_list_reassign.o 35 get_header_tar_gz.o \ 36 get_header_tar_bz2.o \ 37 get_header_tar_lzma.o \ 35 38 36 39 INSERT … … 43 46 lib-$(CONFIG_DPKG) += $(DPKG_FILES) 44 47 lib-$(CONFIG_DPKG_DEB) += $(DPKG_FILES) 45 lib-$(CONFIG_GUNZIP) += decompress_unzip.o46 lib-$(CONFIG_RPM2CPIO) += decompress_ unzip.o get_header_cpio.o47 lib-$(CONFIG_RPM) += open_transformer.o decompress_ unzip.o get_header_cpio.o48 lib-$(CONFIG_GUNZIP) += open_transformer.o decompress_gunzip.o 49 lib-$(CONFIG_RPM2CPIO) += decompress_gunzip.o get_header_cpio.o 50 lib-$(CONFIG_RPM) += open_transformer.o decompress_gunzip.o get_header_cpio.o 48 51 lib-$(CONFIG_TAR) += get_header_tar.o 49 52 lib-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o 50 lib-$(CONFIG_UNZIP) += decompress_ unzip.o53 lib-$(CONFIG_UNZIP) += decompress_gunzip.o 51 54 lib-$(CONFIG_LZOP) += lzo1x_1.o lzo1x_1o.o lzo1x_d.o 52 55 lib-$(CONFIG_LZOP_COMPR_HIGH) += lzo1x_9x.o 56 lib-$(CONFIG_MODINFO) += open_transformer.o 57 lib-$(CONFIG_INSMOD) += open_transformer.o 53 58 lib-$(CONFIG_FEATURE_SEAMLESS_Z) += open_transformer.o decompress_uncompress.o 54 lib-$(CONFIG_FEATURE_SEAMLESS_GZ) += open_transformer.o decompress_ unzip.o get_header_tar_gz.o55 lib-$(CONFIG_FEATURE_SEAMLESS_BZ2) += open_transformer.o decompress_bunzip2.o get_header_tar_bz2.o56 lib-$(CONFIG_FEATURE_SEAMLESS_LZMA) += open_transformer.o decompress_unlzma.o get_header_tar_lzma.o59 lib-$(CONFIG_FEATURE_SEAMLESS_GZ) += open_transformer.o decompress_gunzip.o 60 lib-$(CONFIG_FEATURE_SEAMLESS_BZ2) += open_transformer.o decompress_bunzip2.o 61 lib-$(CONFIG_FEATURE_SEAMLESS_LZMA) += open_transformer.o decompress_unlzma.o 57 62 lib-$(CONFIG_FEATURE_SEAMLESS_XZ) += open_transformer.o decompress_unxz.o 58 lib-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o63 lib-$(CONFIG_FEATURE_COMPRESS_USAGE) += open_transformer.o decompress_bunzip2.o 59 64 lib-$(CONFIG_FEATURE_COMPRESS_BBCONFIG) += decompress_bunzip2.o 60 65 lib-$(CONFIG_FEATURE_TAR_TO_COMMAND) += data_extract_to_command.o -
branches/3.2/mindi-busybox/archival/libarchive/bz/blocksort.c
r2725 r3232 386 386 */ 387 387 388 #if CONFIG_BZIP2_F EATURE_SPEED>= 1388 #if CONFIG_BZIP2_FAST >= 1 389 389 390 390 #define TIMES_8(code) \ … … 497 497 498 498 /* 1.5% overall speedup, +290 bytes */ 499 #if CONFIG_BZIP2_F EATURE_SPEED>= 3499 #if CONFIG_BZIP2_FAST >= 3 500 500 /*-- copy 2 --*/ 501 501 if (i > hi) break; … … 751 751 i = nblock - 1; 752 752 /* 3%, +300 bytes */ 753 #if CONFIG_BZIP2_F EATURE_SPEED>= 2753 #if CONFIG_BZIP2_FAST >= 2 754 754 for (; i >= 3; i -= 4) { 755 755 quadrant[i] = 0; … … 788 788 s = block[0] << 8; 789 789 i = nblock - 1; 790 #if CONFIG_BZIP2_F EATURE_SPEED>= 2790 #if CONFIG_BZIP2_FAST >= 2 791 791 for (; i >= 3; i -= 4) { 792 792 s = (s >> 8) | (block[i] << 8); -
branches/3.2/mindi-busybox/archival/libarchive/bz/bzlib_private.h
r2725 r3232 184 184 int32_t sendMTFValues__code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; 185 185 int32_t sendMTFValues__rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; 186 #if CONFIG_BZIP2_F EATURE_SPEED>= 5186 #if CONFIG_BZIP2_FAST >= 5 187 187 /* second dimension: only 3 needed; 4 makes index calculations faster */ 188 188 uint32_t sendMTFValues__len_pack[BZ_MAX_ALPHA_SIZE][4]; -
branches/3.2/mindi-busybox/archival/libarchive/bz/compress.c
r2725 r3232 62 62 static 63 63 /* Helps only on level 5, on other levels hurts. ? */ 64 #if CONFIG_BZIP2_F EATURE_SPEED>= 564 #if CONFIG_BZIP2_FAST >= 5 65 65 ALWAYS_INLINE 66 66 #endif … … 252 252 int32_t v, t, i, j, gs, ge, totc, bt, bc, iter; 253 253 int32_t nSelectors, alphaSize, minLen, maxLen, selCtr; 254 int32_t nGroups , nBytes;254 int32_t nGroups; 255 255 256 256 /* … … 332 332 s->rfreq[t][v] = 0; 333 333 334 #if CONFIG_BZIP2_F EATURE_SPEED>= 5334 #if CONFIG_BZIP2_FAST >= 5 335 335 /* 336 336 * Set up an auxiliary length table which is used to fast-track … … 362 362 for (t = 0; t < nGroups; t++) 363 363 cost[t] = 0; 364 #if CONFIG_BZIP2_F EATURE_SPEED>= 5364 #if CONFIG_BZIP2_FAST >= 5 365 365 if (nGroups == 6 && 50 == ge-gs+1) { 366 366 /*--- fast track the common case ---*/ … … 421 421 */ 422 422 /* 1% faster compress. +800 bytes */ 423 #if CONFIG_BZIP2_F EATURE_SPEED>= 4423 #if CONFIG_BZIP2_FAST >= 4 424 424 if (nGroups == 6 && 50 == ge-gs+1) { 425 425 /*--- fast track the common case ---*/ … … 513 513 } 514 514 515 nBytes = s->numZ;516 515 bsW(s, 16, inUse16); 517 516 … … 529 528 530 529 /*--- Now the selectors. ---*/ 531 nBytes = s->numZ;532 530 bsW(s, 3, nGroups); 533 531 bsW(s, 15, nSelectors); … … 539 537 540 538 /*--- Now the coding tables. ---*/ 541 nBytes = s->numZ;542 543 539 for (t = 0; t < nGroups; t++) { 544 540 int32_t curr = s->len[t][0]; … … 552 548 553 549 /*--- And finally, the block data proper ---*/ 554 nBytes = s->numZ;555 550 selCtr = 0; 556 551 gs = 0; -
branches/3.2/mindi-busybox/archival/libarchive/bz/huffman.c
r2725 r3232 49 49 50 50 /* 90 bytes, 0.3% of overall compress speed */ 51 #if CONFIG_BZIP2_F EATURE_SPEED>= 151 #if CONFIG_BZIP2_FAST >= 1 52 52 53 53 /* macro works better than inline (gcc 4.2.1) */ -
branches/3.2/mindi-busybox/archival/libarchive/data_align.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include " archive.h"7 #include "bb_archive.h" 8 8 9 9 void FAST_FUNC data_align(archive_handle_t *archive_handle, unsigned boundary) -
branches/3.2/mindi-busybox/archival/libarchive/data_extract_all.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include " archive.h"7 #include "bb_archive.h" 8 8 9 9 void FAST_FUNC data_extract_all(archive_handle_t *archive_handle) … … 14 14 15 15 #if ENABLE_FEATURE_TAR_SELINUX 16 char *sctx = archive_handle->tar__ next_file_sctx;16 char *sctx = archive_handle->tar__sctx[PAX_NEXT_FILE]; 17 17 if (!sctx) 18 sctx = archive_handle->tar__ global_sctx;18 sctx = archive_handle->tar__sctx[PAX_GLOBAL]; 19 19 if (sctx) { /* setfscreatecon is 4 syscalls, avoid if possible */ 20 20 setfscreatecon(sctx); 21 free(archive_handle->tar__ next_file_sctx);22 archive_handle->tar__ next_file_sctx= NULL;21 free(archive_handle->tar__sctx[PAX_NEXT_FILE]); 22 archive_handle->tar__sctx[PAX_NEXT_FILE] = NULL; 23 23 } 24 24 #endif -
branches/3.2/mindi-busybox/archival/libarchive/data_extract_to_command.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include " archive.h"7 #include "bb_archive.h" 8 8 9 9 enum { … … 65 65 66 66 #if 0 /* do we need this? ENABLE_FEATURE_TAR_SELINUX */ 67 char *sctx = archive_handle->tar__ next_file_sctx;67 char *sctx = archive_handle->tar__sctx[PAX_NEXT_FILE]; 68 68 if (!sctx) 69 sctx = archive_handle->tar__ global_sctx;69 sctx = archive_handle->tar__sctx[PAX_GLOBAL]; 70 70 if (sctx) { /* setfscreatecon is 4 syscalls, avoid if possible */ 71 71 setfscreatecon(sctx); 72 free(archive_handle->tar__ next_file_sctx);73 archive_handle->tar__ next_file_sctx= NULL;72 free(archive_handle->tar__sctx[PAX_NEXT_FILE]); 73 archive_handle->tar__sctx[PAX_NEXT_FILE] = NULL; 74 74 } 75 75 #endif … … 100 100 xdup2(p[0], STDIN_FILENO); 101 101 signal(SIGPIPE, SIG_DFL); 102 execl(DEFAULT_SHELL, DEFAULT_SHELL_SHORT_NAME, "-c", archive_handle->tar__to_command, NULL); 103 bb_perror_msg_and_die("can't execute '%s'", DEFAULT_SHELL); 102 execl(archive_handle->tar__to_command_shell, 103 archive_handle->tar__to_command_shell, 104 "-c", 105 archive_handle->tar__to_command, 106 NULL); 107 bb_perror_msg_and_die("can't execute '%s'", archive_handle->tar__to_command_shell); 104 108 } 105 109 close(p[0]); -
branches/3.2/mindi-busybox/archival/libarchive/data_extract_to_stdout.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include " archive.h"7 #include "bb_archive.h" 8 8 9 9 void FAST_FUNC data_extract_to_stdout(archive_handle_t *archive_handle) -
branches/3.2/mindi-busybox/archival/libarchive/data_skip.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include " archive.h"7 #include "bb_archive.h" 8 8 9 9 void FAST_FUNC data_skip(archive_handle_t *archive_handle) -
branches/3.2/mindi-busybox/archival/libarchive/decompress_bunzip2.c
r2725 r3232 41 41 42 42 #include "libbb.h" 43 #include " archive.h"43 #include "bb_archive.h" 44 44 45 45 /* Constants for Huffman coding */ … … 722 722 /* Decompress src_fd to dst_fd. Stops at end of bzip data, not end of file. */ 723 723 IF_DESKTOP(long long) int FAST_FUNC 724 unpack_bz2_stream( int src_fd, int dst_fd)724 unpack_bz2_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) 725 725 { 726 726 IF_DESKTOP(long long total_written = 0;) … … 729 729 int i; 730 730 unsigned len; 731 732 if (check_signature16(aux, src_fd, BZIP2_MAGIC)) 733 return -1; 731 734 732 735 outbuf = xmalloc(IOBUF_SIZE); … … 753 756 } 754 757 755 if (i != RETVAL_LAST_BLOCK) { 758 if (i != RETVAL_LAST_BLOCK 759 /* Observed case when i == RETVAL_OK: 760 * "bzcat z.bz2", where "z.bz2" is a bzipped zero-length file 761 * (to be exact, z.bz2 is exactly these 14 bytes: 762 * 42 5a 68 39 17 72 45 38 50 90 00 00 00 00). 763 */ 764 && i != RETVAL_OK 765 ) { 756 766 bb_error_msg("bunzip error %d", i); 757 767 break; … … 788 798 } 789 799 790 IF_DESKTOP(long long) int FAST_FUNC791 unpack_bz2_stream_prime(int src_fd, int dst_fd)792 {793 uint16_t magic2;794 xread(src_fd, &magic2, 2);795 if (magic2 != BZIP2_MAGIC) {796 bb_error_msg_and_die("invalid magic");797 }798 return unpack_bz2_stream(src_fd, dst_fd);799 }800 801 800 #ifdef TESTING 802 801 … … 813 812 char c; 814 813 815 int i = unpack_bz2_stream _prime(0, 1);814 int i = unpack_bz2_stream(0, 1); 816 815 if (i < 0) 817 816 fprintf(stderr, "%s\n", bunzip_errors[-i]); -
branches/3.2/mindi-busybox/archival/libarchive/decompress_uncompress.c
r2725 r3232 26 26 27 27 #include "libbb.h" 28 #include " archive.h"28 #include "bb_archive.h" 29 29 30 30 … … 74 74 75 75 IF_DESKTOP(long long) int FAST_FUNC 76 unpack_Z_stream( int fd_in, int fd_out)76 unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) 77 77 { 78 78 IF_DESKTOP(long long total_written = 0;) 79 79 IF_DESKTOP(long long) int retval = -1; 80 80 unsigned char *stackp; 81 long code;82 81 int finchar; 83 82 long oldcode; … … 104 103 int block_mode; /* = BLOCK_MODE; */ 105 104 105 if (check_signature16(aux, src_fd, COMPRESS_MAGIC)) 106 return -1; 107 106 108 inbuf = xzalloc(IBUFSIZ + 64); 107 109 outbuf = xzalloc(OBUFSIZ + 2048); 108 htab = xzalloc(HSIZE); /* w sn't zeroed out before, maybe can xmalloc? */110 htab = xzalloc(HSIZE); /* wasn't zeroed out before, maybe can xmalloc? */ 109 111 codetab = xzalloc(HSIZE * sizeof(codetab[0])); 110 112 … … 113 115 /* xread isn't good here, we have to return - caller may want 114 116 * to do some cleanup (e.g. delete incomplete unpacked file etc) */ 115 if (full_read( fd_in, inbuf, 1) != 1) {117 if (full_read(src_fd, inbuf, 1) != 1) { 116 118 bb_error_msg("short read"); 117 119 goto err; … … 141 143 /*clear_tab_prefixof(); - done by xzalloc */ 142 144 143 for (code = 255; code >= 0; --code) { 144 tab_suffixof(code) = (unsigned char) code; 145 { 146 int i; 147 for (i = 255; i >= 0; --i) 148 tab_suffixof(i) = (unsigned char) i; 145 149 } 146 150 … … 163 167 164 168 if (insize < (int) (IBUFSIZ + 64) - IBUFSIZ) { 165 rsize = safe_read(fd_in, inbuf + insize, IBUFSIZ); 166 //error check?? 169 rsize = safe_read(src_fd, inbuf + insize, IBUFSIZ); 170 if (rsize < 0) 171 bb_error_msg_and_die(bb_msg_read_error); 167 172 insize += rsize; 168 173 } … … 172 177 173 178 while (inbits > posbits) { 179 long code; 180 174 181 if (free_ent > maxcode) { 175 182 posbits = … … 188 195 { 189 196 unsigned char *p = &inbuf[posbits >> 3]; 190 191 code = ((((long) (p[0])) | ((long) (p[1]) << 8) |192 197 code = ((p[0] 198 | ((long) (p[1]) << 8) 199 | ((long) (p[2]) << 16)) >> (posbits & 0x7)) & bitmask; 193 200 } 194 201 posbits += n_bits; 195 202 196 197 203 if (oldcode == -1) { 204 if (code >= 256) 205 bb_error_msg_and_die("corrupted data"); /* %ld", code); */ 198 206 oldcode = code; 199 207 finchar = (int) oldcode; … … 221 229 if (code >= free_ent) { 222 230 if (code > free_ent) { 231 /* 223 232 unsigned char *p; 224 233 225 234 posbits -= n_bits; 226 235 p = &inbuf[posbits >> 3]; 227 228 236 bb_error_msg 229 237 ("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)", 230 insize, posbits, p[-1], p[0], p[1], p[2], p[3], 231 (posbits & 07)); 238 insize, posbits, p[-1], p[0], p[1], p[2], p[3], 239 (posbits & 07)); 240 */ 232 241 bb_error_msg("corrupted data"); 233 242 goto err; … … 239 248 240 249 /* Generate output characters in reverse order */ 241 while ((long) code >= (long) 256) { 250 while (code >= 256) { 251 if (stackp <= &htabof(0)) 252 bb_error_msg_and_die("corrupted data"); 242 253 *--stackp = tab_suffixof(code); 243 254 code = tab_prefixof(code); … … 264 275 265 276 if (outpos >= OBUFSIZ) { 266 full_write(fd_out, outbuf, outpos); 267 //error check?? 277 xwrite(dst_fd, outbuf, outpos); 268 278 IF_DESKTOP(total_written += outpos;) 269 279 outpos = 0; … … 279 289 280 290 /* Generate the new entry. */ 281 code = free_ent; 282 if (code < maxmaxcode) { 283 tab_prefixof(code) = (unsigned short) oldcode; 284 tab_suffixof(code) = (unsigned char) finchar; 285 free_ent = code + 1; 291 if (free_ent < maxmaxcode) { 292 tab_prefixof(free_ent) = (unsigned short) oldcode; 293 tab_suffixof(free_ent) = (unsigned char) finchar; 294 free_ent++; 286 295 } 287 296 … … 293 302 294 303 if (outpos > 0) { 295 full_write(fd_out, outbuf, outpos); 296 //error check?? 304 xwrite(dst_fd, outbuf, outpos); 297 305 IF_DESKTOP(total_written += outpos;) 298 306 } -
branches/3.2/mindi-busybox/archival/libarchive/decompress_unlzma.c
r2725 r3232 10 10 */ 11 11 #include "libbb.h" 12 #include " archive.h"12 #include "bb_archive.h" 13 13 14 14 #if ENABLE_FEATURE_LZMA_FAST … … 214 214 215 215 IF_DESKTOP(long long) int FAST_FUNC 216 unpack_lzma_stream( int src_fd, int dst_fd)216 unpack_lzma_stream(transformer_aux_data_t *aux UNUSED_PARAM, int src_fd, int dst_fd) 217 217 { 218 218 IF_DESKTOP(long long total_written = 0;) -
branches/3.2/mindi-busybox/archival/libarchive/decompress_unxz.c
r2725 r3232 11 11 */ 12 12 #include "libbb.h" 13 #include " archive.h"13 #include "bb_archive.h" 14 14 15 15 #define XZ_FUNC FAST_FUNC … … 31 31 #define get_unaligned_le32(buf) ({ uint32_t v; move_from_unaligned32(v, buf); SWAP_LE32(v); }) 32 32 #define get_unaligned_be32(buf) ({ uint32_t v; move_from_unaligned32(v, buf); SWAP_BE32(v); }) 33 #define put_unaligned_le32(val, buf) move_to_unaligned 16(buf, SWAP_LE32(val))34 #define put_unaligned_be32(val, buf) move_to_unaligned 16(buf, SWAP_BE32(val))33 #define put_unaligned_le32(val, buf) move_to_unaligned32(buf, SWAP_LE32(val)) 34 #define put_unaligned_be32(val, buf) move_to_unaligned32(buf, SWAP_BE32(val)) 35 35 36 36 #include "unxz/xz_dec_bcj.c" … … 39 39 40 40 IF_DESKTOP(long long) int FAST_FUNC 41 unpack_xz_stream( int src_fd, int dst_fd)41 unpack_xz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) 42 42 { 43 enum xz_ret xz_result; 43 44 struct xz_buf iobuf; 44 45 struct xz_dec *state; … … 50 51 51 52 memset(&iobuf, 0, sizeof(iobuf)); 52 /* Preload XZ file signature */ 53 membuf = (void*) strcpy(xmalloc(2 * BUFSIZ), HEADER_MAGIC); 53 membuf = xmalloc(2 * BUFSIZ); 54 54 iobuf.in = membuf; 55 iobuf.in_size = HEADER_MAGIC_SIZE;56 55 iobuf.out = membuf + BUFSIZ; 57 56 iobuf.out_size = BUFSIZ; 57 58 if (!aux || aux->check_signature == 0) { 59 /* Preload XZ file signature */ 60 strcpy((char*)membuf, HEADER_MAGIC); 61 iobuf.in_size = HEADER_MAGIC_SIZE; 62 } /* else: let xz code read & check it */ 58 63 59 64 /* Limit memory usage to about 64 MiB. */ 60 65 state = xz_dec_init(XZ_DYNALLOC, 64*1024*1024); 61 66 67 xz_result = X_OK; 62 68 while (1) { 63 enum xz_ret r;64 65 69 if (iobuf.in_pos == iobuf.in_size) { 66 70 int rd = safe_read(src_fd, membuf, BUFSIZ); … … 70 74 break; 71 75 } 76 if (rd == 0 && xz_result == XZ_STREAM_END) 77 break; 72 78 iobuf.in_size = rd; 73 79 iobuf.in_pos = 0; 74 80 } 81 if (xz_result == XZ_STREAM_END) { 82 /* 83 * Try to start decoding next concatenated stream. 84 * Stream padding must always be a multiple of four 85 * bytes to preserve four-byte alignment. To keep the 86 * code slightly smaller, we aren't as strict here as 87 * the .xz spec requires. We just skip all zero-bytes 88 * without checking the alignment and thus can accept 89 * files that aren't valid, e.g. the XZ utils test 90 * files bad-0pad-empty.xz and bad-0catpad-empty.xz. 91 */ 92 do { 93 if (membuf[iobuf.in_pos] != 0) { 94 xz_dec_reset(state); 95 goto do_run; 96 } 97 iobuf.in_pos++; 98 } while (iobuf.in_pos < iobuf.in_size); 99 } 100 do_run: 75 101 // bb_error_msg(">in pos:%d size:%d out pos:%d size:%d", 76 102 // iobuf.in_pos, iobuf.in_size, iobuf.out_pos, iobuf.out_size); 77 r= xz_dec_run(state, &iobuf);103 xz_result = xz_dec_run(state, &iobuf); 78 104 // bb_error_msg("<in pos:%d size:%d out pos:%d size:%d r:%d", 79 // iobuf.in_pos, iobuf.in_size, iobuf.out_pos, iobuf.out_size, r);105 // iobuf.in_pos, iobuf.in_size, iobuf.out_pos, iobuf.out_size, xz_result); 80 106 if (iobuf.out_pos) { 81 107 xwrite(dst_fd, iobuf.out, iobuf.out_pos); … … 83 109 iobuf.out_pos = 0; 84 110 } 85 if (r == XZ_STREAM_END) { 86 break; 111 if (xz_result == XZ_STREAM_END) { 112 /* 113 * Can just "break;" here, if not for concatenated 114 * .xz streams. 115 * Checking for padding may require buffer 116 * replenishment. Can't do it here. 117 */ 118 continue; 87 119 } 88 if ( r != XZ_OK && r!= XZ_UNSUPPORTED_CHECK) {120 if (xz_result != XZ_OK && xz_result != XZ_UNSUPPORTED_CHECK) { 89 121 bb_error_msg("corrupted data"); 90 122 total = -1; … … 92 124 } 93 125 } 126 94 127 xz_dec_end(state); 95 128 free(membuf); -
branches/3.2/mindi-busybox/archival/libarchive/filter_accept_all.c
r2725 r3232 7 7 8 8 #include "libbb.h" 9 #include " archive.h"9 #include "bb_archive.h" 10 10 11 11 /* Accept any non-null name, its not really a filter at all */ -
branches/3.2/mindi-busybox/archival/libarchive/filter_accept_list.c
r2725 r3232 7 7 8 8 #include "libbb.h" 9 #include " archive.h"9 #include "bb_archive.h" 10 10 11 11 /* -
branches/3.2/mindi-busybox/archival/libarchive/filter_accept_list_reassign.c
r2725 r3232 7 7 8 8 #include "libbb.h" 9 #include " archive.h"9 #include "bb_archive.h" 10 10 11 11 /* Built and used only if ENABLE_DPKG || ENABLE_DPKG_DEB */ -
branches/3.2/mindi-busybox/archival/libarchive/filter_accept_reject_list.c
r2725 r3232 7 7 8 8 #include "libbb.h" 9 #include " archive.h"9 #include "bb_archive.h" 10 10 11 11 /* … … 25 25 return EXIT_FAILURE; 26 26 } 27 accept_entry = find_list_entry2(archive_handle->accept, key);28 27 29 28 /* Fail if an accept list was specified and the key wasnt in there */ 30 if ((accept_entry == NULL) && archive_handle->accept) { 31 return EXIT_FAILURE; 29 if (archive_handle->accept) { 30 accept_entry = find_list_entry2(archive_handle->accept, key); 31 if (!accept_entry) { 32 return EXIT_FAILURE; 33 } 32 34 } 33 35 -
branches/3.2/mindi-busybox/archival/libarchive/find_list_entry.c
r2725 r3232 8 8 #include <fnmatch.h> 9 9 #include "libbb.h" 10 #include " archive.h"10 #include "bb_archive.h" 11 11 12 12 /* Find a string in a shell pattern list */ -
branches/3.2/mindi-busybox/archival/libarchive/get_header_ar.c
r2725 r3232 6 6 7 7 #include "libbb.h" 8 #include " archive.h"8 #include "bb_archive.h" 9 9 #include "ar.h" 10 10 -
branches/3.2/mindi-busybox/archival/libarchive/get_header_cpio.c
r2725 r3232 6 6 7 7 #include "libbb.h" 8 #include " archive.h"8 #include "bb_archive.h" 9 9 10 10 typedef struct hardlinks_t { -
branches/3.2/mindi-busybox/archival/libarchive/get_header_tar.c
r2725 r3232 13 13 14 14 #include "libbb.h" 15 #include " archive.h"15 #include "bb_archive.h" 16 16 17 17 typedef uint32_t aliased_uint32_t FIX_ALIASING; 18 18 typedef off_t aliased_off_t FIX_ALIASING; 19 19 20 21 const char* FAST_FUNC strip_unsafe_prefix(const char *str) 22 { 23 const char *cp = str; 24 while (1) { 25 char *cp2; 26 if (*cp == '/') { 27 cp++; 28 continue; 29 } 30 if (strncmp(cp, "/../"+1, 3) == 0) { 31 cp += 3; 32 continue; 33 } 34 cp2 = strstr(cp, "/../"); 35 if (!cp2) 36 break; 37 cp = cp2 + 4; 38 } 39 if (cp != str) { 40 static smallint warned = 0; 41 if (!warned) { 42 warned = 1; 43 bb_error_msg("removing leading '%.*s' from member names", 44 (int)(cp - str), str); 45 } 46 } 47 return cp; 48 } 20 49 21 50 /* NB: _DESTROYS_ str[len] character! */ … … 51 80 * NB: tarballs with NEGATIVE unix times encoded that way were seen! 52 81 */ 53 v = first;54 /* Sign-extend using 6th bit: */55 v <<= sizeof(unsigned long long)*8 - 7;56 v = (long long)v >> (sizeof(unsigned long long)*8 - 7);82 /* Sign-extend 7bit 'first' to 64bit 'v' (that is, using 6th bit as sign): */ 83 first <<= 1; 84 first >>= 1; /* now 7th bit = 6th bit */ 85 v = first; /* sign-extend 8 bits to 64 */ 57 86 while (--len != 0) 58 v = (v << 8) + (u nsigned char) *str++;87 v = (v << 8) + (uint8_t) *++str; 59 88 } 60 89 return v; … … 62 91 #define GET_OCTAL(a) getOctal((a), sizeof(a)) 63 92 64 #if ENABLE_FEATURE_TAR_SELINUX 65 /* Scan a PAX header for SELinux contexts, via "RHT.security.selinux" keyword. 66 * This is what Red Hat's patched version of tar uses. 67 */ 68 # define SELINUX_CONTEXT_KEYWORD "RHT.security.selinux" 69 static char *get_selinux_sctx_from_pax_hdr(archive_handle_t *archive_handle, unsigned sz) 93 /* "global" is 0 or 1 */ 94 static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int global) 70 95 { 71 96 char *buf, *p; 72 char *result; 73 74 p = buf = xmalloc(sz + 1); 97 unsigned blk_sz; 98 99 blk_sz = (sz + 511) & (~511); 100 p = buf = xmalloc(blk_sz + 1); 101 xread(archive_handle->src_fd, buf, blk_sz); 102 archive_handle->offset += blk_sz; 103 75 104 /* prevent bb_strtou from running off the buffer */ 76 105 buf[sz] = '\0'; 77 xread(archive_handle->src_fd, buf, sz); 78 archive_handle->offset += sz; 79 80 result = NULL; 106 81 107 while (sz != 0) { 82 108 char *end, *value; … … 105 131 */ 106 132 p[-1] = '\0'; 107 /* Is it selinux security context? */108 133 value = end + 1; 134 135 #if ENABLE_FEATURE_TAR_GNU_EXTENSIONS 136 if (!global && strncmp(value, "path=", sizeof("path=") - 1) == 0) { 137 value += sizeof("path=") - 1; 138 free(archive_handle->tar__longname); 139 archive_handle->tar__longname = xstrdup(value); 140 continue; 141 } 142 #endif 143 144 #if ENABLE_FEATURE_TAR_SELINUX 145 /* Scan for SELinux contexts, via "RHT.security.selinux" keyword. 146 * This is what Red Hat's patched version of tar uses. 147 */ 148 # define SELINUX_CONTEXT_KEYWORD "RHT.security.selinux" 109 149 if (strncmp(value, SELINUX_CONTEXT_KEYWORD"=", sizeof(SELINUX_CONTEXT_KEYWORD"=") - 1) == 0) { 110 150 value += sizeof(SELINUX_CONTEXT_KEYWORD"=") - 1; 111 result = xstrdup(value); 112 break; 113 } 151 free(archive_handle->tar__sctx[global]); 152 archive_handle->tar__sctx[global] = xstrdup(value); 153 continue; 154 } 155 #endif 114 156 } 115 157 116 158 free(buf); 117 return result;118 159 } 119 #endif120 160 121 161 char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) … … 196 236 ) { 197 237 #if ENABLE_FEATURE_TAR_AUTODETECT 198 char FAST_FUNC (*get_header_ptr)(archive_handle_t *);199 uint16_t magic2;200 201 238 autodetect: 202 magic2 = *(uint16_t*)tar.name;203 /* tar gz/bz autodetect: check for gz/bz2 magic.204 * If we see the magic, and it is the very first block,205 * we can switch to get_header_tar_gz/bz2/lzma().206 * Needs seekable fd. I wish recv(MSG_PEEK) works207 * on any fd... */208 # if ENABLE_FEATURE_SEAMLESS_GZ209 if (magic2 == GZIP_MAGIC) {210 get_header_ptr = get_header_tar_gz;211 } else212 # endif213 # if ENABLE_FEATURE_SEAMLESS_BZ2214 if (magic2 == BZIP2_MAGIC215 && tar.name[2] == 'h' && isdigit(tar.name[3])216 ) { /* bzip2 */217 get_header_ptr = get_header_tar_bz2;218 } else219 # endif220 # if ENABLE_FEATURE_SEAMLESS_XZ221 //TODO: if (magic2 == XZ_MAGIC1)...222 //else223 # endif224 goto err;225 239 /* Two different causes for lseek() != 0: 226 240 * unseekable fd (would like to support that too, but...), … … 228 242 if (lseek(archive_handle->src_fd, -i, SEEK_CUR) != 0) 229 243 goto err; 230 while (get_header_ptr(archive_handle) == EXIT_SUCCESS) 231 continue; 232 return EXIT_FAILURE; 244 if (setup_unzip_on_fd(archive_handle->src_fd, /*fail_if_not_detected:*/ 0) != 0) 233 245 err: 234 #endif /* FEATURE_TAR_AUTODETECT */ 246 bb_error_msg_and_die("invalid tar magic"); 247 archive_handle->offset = 0; 248 goto again_after_align; 249 #endif 235 250 bb_error_msg_and_die("invalid tar magic"); 236 251 } … … 320 335 /* (typeflag was not trashed because chksum does not use getOctal) */ 321 336 switch (tar.typeflag) { 322 /* busybox identifies hard links as being regular files with 0 size and a link name*/323 case '1':337 case '1': /* hardlink */ 338 /* we mark hardlinks as regular files with zero size and a link name */ 324 339 file_header->mode |= S_IFREG; 325 break; 340 /* on size of link fields from star(4) 341 * ... For tar archives written by pre POSIX.1-1988 342 * implementations, the size field usually contains the size of 343 * the file and needs to be ignored as no data may follow this 344 * header type. For POSIX.1- 1988 compliant archives, the size 345 * field needs to be 0. For POSIX.1-2001 compliant archives, 346 * the size field may be non zero, indicating that file data is 347 * included in the archive. 348 * i.e; always assume this is zero for safety. 349 */ 350 goto size0; 326 351 case '7': 327 352 /* case 0: */ … … 380 405 case 'V': /* Volume header */ 381 406 #endif 382 #if !ENABLE_FEATURE_TAR_SELINUX383 407 case 'g': /* pax global header */ 384 case 'x': /* pax extended header */ 385 #else 408 case 'x': { /* pax extended header */ 409 if ((uoff_t)file_header->size > 0xfffff) /* paranoia */ 410 goto skip_ext_hdr; 411 process_pax_hdr(archive_handle, file_header->size, (tar.typeflag == 'g')); 412 goto again_after_align; 413 } 386 414 skip_ext_hdr: 387 #endif388 415 { 389 416 off_t sz; … … 397 424 goto again_after_align; 398 425 } 399 #if ENABLE_FEATURE_TAR_SELINUX400 case 'g': /* pax global header */401 case 'x': { /* pax extended header */402 char **pp;403 if ((uoff_t)file_header->size > 0xfffff) /* paranoia */404 goto skip_ext_hdr;405 pp = (tar.typeflag == 'g') ? &archive_handle->tar__global_sctx : &archive_handle->tar__next_file_sctx;406 free(*pp);407 *pp = get_selinux_sctx_from_pax_hdr(archive_handle, file_header->size);408 goto again;409 }410 #endif411 426 default: 412 427 bb_error_msg_and_die("unknown typeflag: 0x%x", tar.typeflag); … … 423 438 } 424 439 #endif 425 if (strncmp(file_header->name, "/../"+1, 3) == 0 426 || strstr(file_header->name, "/../") 427 ) { 428 bb_error_msg_and_die("name with '..' encountered: '%s'", 429 file_header->name); 430 } 440 441 /* Everything up to and including last ".." component is stripped */ 442 overlapping_strcpy(file_header->name, strip_unsafe_prefix(file_header->name)); 431 443 432 444 /* Strip trailing '/' in directories */ … … 441 453 *cp = '\0'; 442 454 archive_handle->action_data(archive_handle); 443 if (archive_handle->accept || archive_handle->reject) 455 if (archive_handle->accept || archive_handle->reject 456 || (archive_handle->ah_flags & ARCHIVE_REMEMBER_NAMES) 457 ) { 444 458 llist_add_to(&archive_handle->passed, file_header->name); 445 else /* Caller isn't interested in list of unpacked files */459 } else /* Caller isn't interested in list of unpacked files */ 446 460 free(file_header->name); 447 461 } else { -
branches/3.2/mindi-busybox/archival/libarchive/get_header_tar_bz2.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include " archive.h"7 #include "bb_archive.h" 8 8 9 9 char FAST_FUNC get_header_tar_bz2(archive_handle_t *archive_handle) … … 12 12 archive_handle->seek = seek_by_read; 13 13 14 open_transformer (archive_handle->src_fd, unpack_bz2_stream_prime, "bunzip2");14 open_transformer_with_sig(archive_handle->src_fd, unpack_bz2_stream, "bunzip2"); 15 15 archive_handle->offset = 0; 16 16 while (get_header_tar(archive_handle) == EXIT_SUCCESS) -
branches/3.2/mindi-busybox/archival/libarchive/get_header_tar_gz.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include " archive.h"7 #include "bb_archive.h" 8 8 9 9 char FAST_FUNC get_header_tar_gz(archive_handle_t *archive_handle) 10 10 { 11 #if BB_MMU12 unsigned char magic[2];13 #endif14 15 11 /* Can't lseek over pipes */ 16 12 archive_handle->seek = seek_by_read; 17 13 18 /* Check gzip magic only if open_transformer will invoke unpack_gz_stream (MMU case). 19 * Otherwise, it will invoke an external helper "gunzip -cf" (NOMMU case) which will 20 * need the header. */ 21 #if BB_MMU 22 xread(archive_handle->src_fd, &magic, 2); 23 /* Can skip this check, but error message will be less clear */ 24 if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) { 25 bb_error_msg_and_die("invalid gzip magic"); 26 } 27 #endif 28 29 open_transformer(archive_handle->src_fd, unpack_gz_stream, "gunzip"); 14 open_transformer_with_sig(archive_handle->src_fd, unpack_gz_stream, "gunzip"); 30 15 archive_handle->offset = 0; 31 16 while (get_header_tar(archive_handle) == EXIT_SUCCESS) -
branches/3.2/mindi-busybox/archival/libarchive/get_header_tar_lzma.c
r2725 r3232 8 8 9 9 #include "libbb.h" 10 #include " archive.h"10 #include "bb_archive.h" 11 11 12 12 char FAST_FUNC get_header_tar_lzma(archive_handle_t *archive_handle) … … 15 15 archive_handle->seek = seek_by_read; 16 16 17 open_transformer (archive_handle->src_fd, unpack_lzma_stream, "unlzma");17 open_transformer_with_sig(archive_handle->src_fd, unpack_lzma_stream, "unlzma"); 18 18 archive_handle->offset = 0; 19 19 while (get_header_tar(archive_handle) == EXIT_SUCCESS) -
branches/3.2/mindi-busybox/archival/libarchive/header_list.c
r2725 r3232 4 4 */ 5 5 #include "libbb.h" 6 #include " archive.h"6 #include "bb_archive.h" 7 7 8 8 void FAST_FUNC header_list(const file_header_t *file_header) -
branches/3.2/mindi-busybox/archival/libarchive/header_skip.c
r2725 r3232 4 4 */ 5 5 #include "libbb.h" 6 #include " archive.h"6 #include "bb_archive.h" 7 7 8 8 void FAST_FUNC header_skip(const file_header_t *file_header UNUSED_PARAM) -
branches/3.2/mindi-busybox/archival/libarchive/header_verbose_list.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include " archive.h"7 #include "bb_archive.h" 8 8 9 9 void FAST_FUNC header_verbose_list(const file_header_t *file_header) -
branches/3.2/mindi-busybox/archival/libarchive/init_handle.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include " archive.h"7 #include "bb_archive.h" 8 8 9 9 archive_handle_t* FAST_FUNC init_handle(void) -
branches/3.2/mindi-busybox/archival/libarchive/lzo1x_9x.c
r2725 r3232 645 645 646 646 static int min_gain(unsigned ahead, unsigned lit1, 647 647 unsigned lit2, int l1, int l2, int l3) 648 648 { 649 649 int lazy_match_min_gain = 0; … … 674 674 675 675 static void better_match(const lzo_swd_p swd, 676 676 unsigned *m_len, unsigned *m_off) 677 677 { 678 678 if (*m_len <= M2_MIN_LEN) … … 915 915 compression_level -= 7; 916 916 return lzo1x_999_compress_internal(in, in_len, out, out_len, wrkmem, 917 918 919 920 921 } 917 c[compression_level].good_length, 918 c[compression_level].max_lazy, 919 c[compression_level].max_chain, 920 c[compression_level].use_best_off); 921 } -
branches/3.2/mindi-busybox/archival/libarchive/lzo1x_c.c
r2725 r3232 16 16 The LZO library is distributed in the hope that it will be useful, 17 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 19 GNU General Public License for more details. 20 20 -
branches/3.2/mindi-busybox/archival/libarchive/lzo1x_d.c
r2725 r3232 16 16 The LZO library is distributed in the hope that it will be useful, 17 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 19 GNU General Public License for more details. 20 20 -
branches/3.2/mindi-busybox/archival/libarchive/open_transformer.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include "archive.h" 7 #include "bb_archive.h" 8 9 void FAST_FUNC init_transformer_aux_data(transformer_aux_data_t *aux) 10 { 11 memset(aux, 0, sizeof(*aux)); 12 } 13 14 int FAST_FUNC check_signature16(transformer_aux_data_t *aux, int src_fd, unsigned magic16) 15 { 16 if (aux && aux->check_signature) { 17 uint16_t magic2; 18 if (full_read(src_fd, &magic2, 2) != 2 || magic2 != magic16) { 19 bb_error_msg("invalid magic"); 20 #if 0 /* possible future extension */ 21 if (aux->check_signature > 1) 22 xfunc_die(); 23 #endif 24 return -1; 25 } 26 } 27 return 0; 28 } 29 30 void check_errors_in_children(int signo) 31 { 32 int status; 33 34 if (!signo) { 35 /* block waiting for any child */ 36 if (wait(&status) < 0) 37 return; /* probably there are no children */ 38 goto check_status; 39 } 40 41 /* Wait for any child without blocking */ 42 for (;;) { 43 if (wait_any_nohang(&status) < 0) 44 /* wait failed?! I'm confused... */ 45 return; 46 check_status: 47 if (WIFEXITED(status) && WEXITSTATUS(status) == 0) 48 /* this child exited with 0 */ 49 continue; 50 /* Cannot happen? 51 if (!WIFSIGNALED(status) && !WIFEXITED(status)) ???; */ 52 bb_got_signal = 1; 53 } 54 } 8 55 9 56 /* transformer(), more than meets the eye */ 10 /* 11 * On MMU machine, the transform_prog is removed by macro magic 12 * in include/archive.h. On NOMMU, transformer is removed. 13 */ 57 #if BB_MMU 14 58 void FAST_FUNC open_transformer(int fd, 15 IF_DESKTOP(long long) int FAST_FUNC (*transformer)(int src_fd, int dst_fd), 16 const char *transform_prog) 59 int check_signature, 60 IF_DESKTOP(long long) int FAST_FUNC (*transformer)(transformer_aux_data_t *aux, int src_fd, int dst_fd) 61 ) 62 #else 63 void FAST_FUNC open_transformer(int fd, const char *transform_prog) 64 #endif 17 65 { 18 66 struct fd_pair fd_pipe; … … 26 74 // FIXME: error check? 27 75 #if BB_MMU 28 transformer(fd, fd_pipe.wr); 29 if (ENABLE_FEATURE_CLEAN_UP) { 30 close(fd_pipe.wr); /* send EOF */ 31 close(fd); 32 } 33 /* must be _exit! bug was actually seen here */ 34 _exit(EXIT_SUCCESS); 76 { 77 transformer_aux_data_t aux; 78 init_transformer_aux_data(&aux); 79 aux.check_signature = check_signature; 80 transformer(&aux, fd, fd_pipe.wr); 81 if (ENABLE_FEATURE_CLEAN_UP) { 82 close(fd_pipe.wr); /* send EOF */ 83 close(fd); 84 } 85 /* must be _exit! bug was actually seen here */ 86 _exit(EXIT_SUCCESS); 87 } 35 88 #else 36 89 { … … 53 106 xmove_fd(fd_pipe.rd, fd); 54 107 } 108 109 110 #if SEAMLESS_COMPRESSION 111 112 /* Used by e.g. rpm which gives us a fd without filename, 113 * thus we can't guess the format from filename's extension. 114 */ 115 int FAST_FUNC setup_unzip_on_fd(int fd, int fail_if_not_detected) 116 { 117 union { 118 uint8_t b[4]; 119 uint16_t b16[2]; 120 uint32_t b32[1]; 121 } magic; 122 int offset = -2; 123 USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_aux_data_t *aux, int src_fd, int dst_fd);) 124 USE_FOR_NOMMU(const char *xformer_prog;) 125 126 /* .gz and .bz2 both have 2-byte signature, and their 127 * unpack_XXX_stream wants this header skipped. */ 128 xread(fd, magic.b16, sizeof(magic.b16[0])); 129 if (ENABLE_FEATURE_SEAMLESS_GZ 130 && magic.b16[0] == GZIP_MAGIC 131 ) { 132 USE_FOR_MMU(xformer = unpack_gz_stream;) 133 USE_FOR_NOMMU(xformer_prog = "gunzip";) 134 goto found_magic; 135 } 136 if (ENABLE_FEATURE_SEAMLESS_BZ2 137 && magic.b16[0] == BZIP2_MAGIC 138 ) { 139 USE_FOR_MMU(xformer = unpack_bz2_stream;) 140 USE_FOR_NOMMU(xformer_prog = "bunzip2";) 141 goto found_magic; 142 } 143 if (ENABLE_FEATURE_SEAMLESS_XZ 144 && magic.b16[0] == XZ_MAGIC1 145 ) { 146 offset = -6; 147 xread(fd, magic.b32, sizeof(magic.b32[0])); 148 if (magic.b32[0] == XZ_MAGIC2) { 149 USE_FOR_MMU(xformer = unpack_xz_stream;) 150 USE_FOR_NOMMU(xformer_prog = "unxz";) 151 goto found_magic; 152 } 153 } 154 155 /* No known magic seen */ 156 if (fail_if_not_detected) 157 bb_error_msg_and_die("no gzip" 158 IF_FEATURE_SEAMLESS_BZ2("/bzip2") 159 IF_FEATURE_SEAMLESS_XZ("/xz") 160 " magic"); 161 xlseek(fd, offset, SEEK_CUR); 162 return 1; 163 164 found_magic: 165 # if BB_MMU 166 open_transformer_with_no_sig(fd, xformer); 167 # else 168 /* NOMMU version of open_transformer execs 169 * an external unzipper that wants 170 * file position at the start of the file */ 171 xlseek(fd, offset, SEEK_CUR); 172 open_transformer_with_sig(fd, xformer, xformer_prog); 173 # endif 174 return 0; 175 } 176 177 int FAST_FUNC open_zipped(const char *fname) 178 { 179 char *sfx; 180 int fd; 181 182 fd = open(fname, O_RDONLY); 183 if (fd < 0) 184 return fd; 185 186 sfx = strrchr(fname, '.'); 187 if (sfx) { 188 sfx++; 189 if (ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, "lzma") == 0) 190 /* .lzma has no header/signature, just trust it */ 191 open_transformer_with_sig(fd, unpack_lzma_stream, "unlzma"); 192 else 193 if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, "gz") == 0) 194 || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, "bz2") == 0) 195 || (ENABLE_FEATURE_SEAMLESS_XZ && strcmp(sfx, "xz") == 0) 196 ) { 197 setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 1); 198 } 199 } 200 201 return fd; 202 } 203 204 #endif /* SEAMLESS_COMPRESSION */ 205 206 void* FAST_FUNC xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p) 207 { 208 int fd; 209 char *image; 210 211 fd = open_zipped(fname); 212 if (fd < 0) 213 return NULL; 214 215 image = xmalloc_read(fd, maxsz_p); 216 if (!image) 217 bb_perror_msg("read error from '%s'", fname); 218 close(fd); 219 220 return image; 221 } -
branches/3.2/mindi-busybox/archival/libarchive/seek_by_jump.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include " archive.h"7 #include "bb_archive.h" 8 8 9 9 void FAST_FUNC seek_by_jump(int fd, off_t amount) -
branches/3.2/mindi-busybox/archival/libarchive/seek_by_read.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include " archive.h"7 #include "bb_archive.h" 8 8 9 9 /* If we are reading through a pipe, or from stdin then we can't lseek, -
branches/3.2/mindi-busybox/archival/libarchive/unpack_ar_archive.c
r2725 r3232 5 5 6 6 #include "libbb.h" 7 #include " archive.h"7 #include "bb_archive.h" 8 8 #include "ar.h" 9 9
Note:
See TracChangeset
for help on using the changeset viewer.