Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/archival
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- Location:
- branches/3.2/mindi-busybox/archival
- Files:
-
- 49 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/archival/Config.src
r2725 r3232 33 33 34 34 config FEATURE_SEAMLESS_Z 35 bool " Make tar and gunzipunderstand .Z data"36 default n 37 help 38 Make tar and gunzipunderstand .Z data.35 bool "tar, rpm, modprobe etc understand .Z data" 36 default n 37 help 38 Make tar, rpm, modprobe etc understand .Z data. 39 39 40 40 config AR … … 188 188 Enable use of long options, increases size by about 106 Bytes 189 189 190 config GZIP_FAST 191 int "Trade memory for gzip speed (0:small,slow - 2:fast,big)" 192 default 0 193 range 0 2 194 depends on GZIP 195 help 196 Enable big memory options for gzip. 197 0: small buffers, small hash-tables 198 1: larger buffers, larger hash-tables 199 2: larger buffers, largest hash-tables 200 Larger models may give slightly better compression 201 190 202 config LZOP 191 203 bool "lzop" … … 331 343 compressors. 332 344 333 The BusyBox unlzma applet is limited to de -compression only.345 The BusyBox unlzma applet is limited to decompression only. 334 346 On an x86 system, this applet adds about 4K. 335 336 Unless you have a specific application which requires unlzma, you337 should probably say N here.338 347 339 348 config FEATURE_LZMA_FAST 340 349 bool "Optimize unlzma for speed" 341 default y350 default n 342 351 depends on UNLZMA 343 352 help -
branches/3.2/mindi-busybox/archival/ar.c
r2725 r3232 18 18 */ 19 19 20 //usage:#define ar_trivial_usage 21 //usage: "[-o] [-v] [-p] [-t] [-x] ARCHIVE FILES" 22 //usage:#define ar_full_usage "\n\n" 23 //usage: "Extract or list FILES from an ar archive\n" 24 //usage: "\n -o Preserve original dates" 25 //usage: "\n -p Extract to stdout" 26 //usage: "\n -t List" 27 //usage: "\n -x Extract" 28 //usage: "\n -v Verbose" 29 20 30 #include "libbb.h" 21 #include " archive.h"31 #include "bb_archive.h" 22 32 #include "ar.h" 23 33 … … 72 82 73 83 /* 74 * when replacing files in an existing archive, copy from the the84 * when replacing files in an existing archive, copy from the 75 85 * original archive those files that are to be left intact 76 86 */ -
branches/3.2/mindi-busybox/archival/bbunzip.c
r2725 r3232 6 6 */ 7 7 #include "libbb.h" 8 #include " archive.h"8 #include "bb_archive.h" 9 9 10 10 enum { … … 34 34 35 35 int FAST_FUNC bbunpack(char **argv, 36 IF_DESKTOP(long long) int FAST_FUNC (*unpacker)( unpack_info_t *info),36 IF_DESKTOP(long long) int FAST_FUNC (*unpacker)(transformer_aux_data_t *aux), 37 37 char* FAST_FUNC (*make_new_name)(char *filename, const char *expected_ext), 38 38 const char *expected_ext … … 43 43 char *filename, *new_name; 44 44 smallint exitcode = 0; 45 unpack_info_t info;45 transformer_aux_data_t aux; 46 46 47 47 do { … … 99 99 } 100 100 101 /* memset(&info, 0, sizeof(info)); */102 info.mtime = 0; /* so far it has one member only */103 status = unpacker(& info);101 init_transformer_aux_data(&aux); 102 aux.check_signature = 1; 103 status = unpacker(&aux); 104 104 if (status < 0) 105 105 exitcode = 1; 106 xclose(STDOUT_FILENO); /* with error check! */ 106 107 if (!(option_mask32 & OPT_STDOUT)) 108 xclose(STDOUT_FILENO); /* with error check! */ 107 109 108 110 if (filename) { … … 110 112 if (status >= 0) { 111 113 /* TODO: restore other things? */ 112 if ( info.mtime) {114 if (aux.mtime != 0) { 113 115 struct timeval times[2]; 114 116 115 times[1].tv_sec = times[0].tv_sec = info.mtime;117 times[1].tv_sec = times[0].tv_sec = aux.mtime; 116 118 times[1].tv_usec = times[0].tv_usec = 0; 117 119 /* Note: we closed it first. … … 143 145 } 144 146 } while (*argv && *++argv); 147 148 if (option_mask32 & OPT_STDOUT) 149 xclose(STDOUT_FILENO); /* with error check! */ 145 150 146 151 return exitcode; … … 168 173 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 169 174 */ 175 176 //usage:#define uncompress_trivial_usage 177 //usage: "[-cf] [FILE]..." 178 //usage:#define uncompress_full_usage "\n\n" 179 //usage: "Decompress .Z file[s]\n" 180 //usage: "\n -c Write to stdout" 181 //usage: "\n -f Overwrite" 182 170 183 #if ENABLE_UNCOMPRESS 171 184 static 172 IF_DESKTOP(long long) int FAST_FUNC unpack_uncompress(unpack_info_t *info UNUSED_PARAM) 173 { 174 IF_DESKTOP(long long) int status = -1; 175 176 if ((xread_char(STDIN_FILENO) != 0x1f) || (xread_char(STDIN_FILENO) != 0x9d)) { 177 bb_error_msg("invalid magic"); 178 } else { 179 status = unpack_Z_stream(STDIN_FILENO, STDOUT_FILENO); 180 } 181 return status; 185 IF_DESKTOP(long long) int FAST_FUNC unpack_uncompress(transformer_aux_data_t *aux) 186 { 187 return unpack_Z_stream(aux, STDIN_FILENO, STDOUT_FILENO); 182 188 } 183 189 int uncompress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; … … 219 225 * See the file algorithm.doc for the compression algorithms and file formats. 220 226 */ 227 228 //usage:#define gunzip_trivial_usage 229 //usage: "[-cft] [FILE]..." 230 //usage:#define gunzip_full_usage "\n\n" 231 //usage: "Decompress FILEs (or stdin)\n" 232 //usage: "\n -c Write to stdout" 233 //usage: "\n -f Force" 234 //usage: "\n -t Test file integrity" 235 //usage: 236 //usage:#define gunzip_example_usage 237 //usage: "$ ls -la /tmp/BusyBox*\n" 238 //usage: "-rw-rw-r-- 1 andersen andersen 557009 Apr 11 10:55 /tmp/BusyBox-0.43.tar.gz\n" 239 //usage: "$ gunzip /tmp/BusyBox-0.43.tar.gz\n" 240 //usage: "$ ls -la /tmp/BusyBox*\n" 241 //usage: "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar\n" 242 //usage: 243 //usage:#define zcat_trivial_usage 244 //usage: "FILE" 245 //usage:#define zcat_full_usage "\n\n" 246 //usage: "Decompress to stdout" 247 221 248 #if ENABLE_GUNZIP 222 249 static … … 246 273 } 247 274 static 248 IF_DESKTOP(long long) int FAST_FUNC unpack_gunzip(unpack_info_t *info) 249 { 250 IF_DESKTOP(long long) int status = -1; 251 252 /* do the decompression, and cleanup */ 253 if (xread_char(STDIN_FILENO) == 0x1f) { 254 unsigned char magic2; 255 256 magic2 = xread_char(STDIN_FILENO); 257 if (ENABLE_FEATURE_SEAMLESS_Z && magic2 == 0x9d) { 258 status = unpack_Z_stream(STDIN_FILENO, STDOUT_FILENO); 259 } else if (magic2 == 0x8b) { 260 status = unpack_gz_stream_with_info(STDIN_FILENO, STDOUT_FILENO, info); 261 } else { 262 goto bad_magic; 263 } 264 if (status < 0) { 265 bb_error_msg("error inflating"); 266 } 267 } else { 268 bad_magic: 269 bb_error_msg("invalid magic"); 270 /* status is still == -1 */ 271 } 272 return status; 275 IF_DESKTOP(long long) int FAST_FUNC unpack_gunzip(transformer_aux_data_t *aux) 276 { 277 return unpack_gz_stream(aux, STDIN_FILENO, STDOUT_FILENO); 273 278 } 274 279 /* … … 309 314 //usage:#define bunzip2_full_usage "\n\n" 310 315 //usage: "Decompress FILEs (or stdin)\n" 311 //usage: "\nOptions:"312 316 //usage: "\n -c Write to stdout" 313 317 //usage: "\n -f Force" … … 316 320 //usage:#define bzcat_full_usage "\n\n" 317 321 //usage: "Decompress to stdout" 318 //applet:IF_BUNZIP2(APPLET(bunzip2, _BB_DIR_USR_BIN, _BB_SUID_DROP))319 //applet:IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, _BB_DIR_USR_BIN, _BB_SUID_DROP, bzcat))322 //applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP)) 323 //applet:IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat)) 320 324 #if ENABLE_BUNZIP2 321 325 static 322 IF_DESKTOP(long long) int FAST_FUNC unpack_bunzip2( unpack_info_t *info UNUSED_PARAM)323 { 324 return unpack_bz2_stream _prime(STDIN_FILENO, STDOUT_FILENO);326 IF_DESKTOP(long long) int FAST_FUNC unpack_bunzip2(transformer_aux_data_t *aux) 327 { 328 return unpack_bz2_stream(aux, STDIN_FILENO, STDOUT_FILENO); 325 329 } 326 330 int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; … … 345 349 * Licensed under GPLv2, see file LICENSE in this source tree. 346 350 */ 351 352 //usage:#define unlzma_trivial_usage 353 //usage: "[-cf] [FILE]..." 354 //usage:#define unlzma_full_usage "\n\n" 355 //usage: "Decompress FILE (or stdin)\n" 356 //usage: "\n -c Write to stdout" 357 //usage: "\n -f Force" 358 //usage: 359 //usage:#define lzma_trivial_usage 360 //usage: "-d [-cf] [FILE]..." 361 //usage:#define lzma_full_usage "\n\n" 362 //usage: "Decompress FILE (or stdin)\n" 363 //usage: "\n -d Decompress" 364 //usage: "\n -c Write to stdout" 365 //usage: "\n -f Force" 366 //usage: 367 //usage:#define lzcat_trivial_usage 368 //usage: "FILE" 369 //usage:#define lzcat_full_usage "\n\n" 370 //usage: "Decompress to stdout" 371 //usage: 372 //usage:#define unxz_trivial_usage 373 //usage: "[-cf] [FILE]..." 374 //usage:#define unxz_full_usage "\n\n" 375 //usage: "Decompress FILE (or stdin)\n" 376 //usage: "\n -c Write to stdout" 377 //usage: "\n -f Force" 378 //usage: 379 //usage:#define xz_trivial_usage 380 //usage: "-d [-cf] [FILE]..." 381 //usage:#define xz_full_usage "\n\n" 382 //usage: "Decompress FILE (or stdin)\n" 383 //usage: "\n -d Decompress" 384 //usage: "\n -c Write to stdout" 385 //usage: "\n -f Force" 386 //usage: 387 //usage:#define xzcat_trivial_usage 388 //usage: "FILE" 389 //usage:#define xzcat_full_usage "\n\n" 390 //usage: "Decompress to stdout" 391 347 392 #if ENABLE_UNLZMA 348 393 static 349 IF_DESKTOP(long long) int FAST_FUNC unpack_unlzma( unpack_info_t *info UNUSED_PARAM)350 { 351 return unpack_lzma_stream( STDIN_FILENO, STDOUT_FILENO);394 IF_DESKTOP(long long) int FAST_FUNC unpack_unlzma(transformer_aux_data_t *aux) 395 { 396 return unpack_lzma_stream(aux, STDIN_FILENO, STDOUT_FILENO); 352 397 } 353 398 int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; … … 372 417 #if ENABLE_UNXZ 373 418 static 374 IF_DESKTOP(long long) int FAST_FUNC unpack_unxz(unpack_info_t *info UNUSED_PARAM) 375 { 376 struct { 377 uint32_t v1; 378 uint16_t v2; 379 } magic; 380 xread(STDIN_FILENO, &magic, 6); 381 if (magic.v1 != XZ_MAGIC1a || magic.v2 != XZ_MAGIC2a) { 382 bb_error_msg("invalid magic"); 383 return -1; 384 } 385 return unpack_xz_stream(STDIN_FILENO, STDOUT_FILENO); 419 IF_DESKTOP(long long) int FAST_FUNC unpack_unxz(transformer_aux_data_t *aux) 420 { 421 return unpack_xz_stream(aux, STDIN_FILENO, STDOUT_FILENO); 386 422 } 387 423 int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; -
branches/3.2/mindi-busybox/archival/bzip2.c
r2725 r3232 8 8 */ 9 9 10 //usage:#define bzip2_trivial_usage 11 //usage: "[OPTIONS] [FILE]..." 12 //usage:#define bzip2_full_usage "\n\n" 13 //usage: "Compress FILEs (or stdin) with bzip2 algorithm\n" 14 //usage: "\n -1..9 Compression level" 15 //usage: "\n -d Decompress" 16 //usage: "\n -c Write to stdout" 17 //usage: "\n -f Force" 18 10 19 #include "libbb.h" 11 #include " archive.h"20 #include "bb_archive.h" 12 21 13 #define CONFIG_BZIP2_F EATURE_SPEED122 #define CONFIG_BZIP2_FAST 1 14 23 15 24 /* Speed test: … … 19 28 * At SPEED 5 difference is 32.7%. 20 29 * 21 * Test run of all CONFIG_BZIP2_F EATURE_SPEEDvalues on a 11Mb text file:30 * Test run of all CONFIG_BZIP2_FAST values on a 11Mb text file: 22 31 * Size Time (3 runs) 23 32 * 0: 10828 4.145 4.146 4.148 … … 103 112 104 113 static 105 IF_DESKTOP(long long) int FAST_FUNC compressStream( unpack_info_t *infoUNUSED_PARAM)114 IF_DESKTOP(long long) int FAST_FUNC compressStream(transformer_aux_data_t *aux UNUSED_PARAM) 106 115 { 107 116 IF_DESKTOP(long long) int total; -
branches/3.2/mindi-busybox/archival/cpio.c
r2725 r3232 13 13 */ 14 14 #include "libbb.h" 15 #include "archive.h" 15 #include "bb_archive.h" 16 17 //usage:#define cpio_trivial_usage 18 //usage: "[-dmvu] [-F FILE]" IF_FEATURE_CPIO_O(" [-H newc]") 19 //usage: " [-ti"IF_FEATURE_CPIO_O("o")"]" IF_FEATURE_CPIO_P(" [-p DIR]") 20 //usage: " [EXTR_FILE]..." 21 //usage:#define cpio_full_usage "\n\n" 22 //usage: "Extract or list files from a cpio archive" 23 //usage: IF_FEATURE_CPIO_O(", or" 24 //usage: "\ncreate an archive" IF_FEATURE_CPIO_P(" (-o) or copy files (-p)") 25 //usage: " using file list on stdin" 26 //usage: ) 27 //usage: "\n" 28 //usage: "\nMain operation mode:" 29 //usage: "\n -t List" 30 //usage: "\n -i Extract EXTR_FILEs (or all)" 31 //usage: IF_FEATURE_CPIO_O( 32 //usage: "\n -o Create (requires -H newc)" 33 //usage: ) 34 //usage: IF_FEATURE_CPIO_P( 35 //usage: "\n -p DIR Copy files to DIR" 36 //usage: ) 37 //usage: "\n -d Make leading directories" 38 //usage: "\n -m Preserve mtime" 39 //usage: "\n -v Verbose" 40 //usage: "\n -u Overwrite" 41 //usage: "\n -F FILE Input (-t,-i,-p) or output (-o) file" 42 //usage: IF_FEATURE_CPIO_O( 43 //usage: "\n -H newc Archive format" 44 //usage: ) 16 45 17 46 /* GNU cpio 2.9 --help (abridged): … … 21 50 -i, --extract Extract files from an archive 22 51 -o, --create Create the archive 23 -p, --pass-through Copy-pass mode [was ist das?!]52 -p, --pass-through Copy-pass mode 24 53 25 54 Options valid in any mode: … … 79 108 -u, --unconditional Replace all files unconditionally 80 109 */ 110 81 111 enum { 82 CPIO_OPT_EXTRACT = (1 << 0),83 CPIO_OPT_TEST = (1 << 1),84 CPIO_OPT_NUL_TERMINATED = (1 << 2),85 CPIO_OPT_UNCONDITIONAL = (1 << 3),86 CPIO_OPT_VERBOSE = (1 << 4),87 CPIO_OPT_CREATE_LEADING_DIR = (1 << 5),88 CPIO_OPT_PRESERVE_MTIME = (1 << 6),89 CPIO_OPT_DEREF = (1 << 7),90 CPIO_OPT_FILE = (1 << 8),112 OPT_EXTRACT = (1 << 0), 113 OPT_TEST = (1 << 1), 114 OPT_NUL_TERMINATED = (1 << 2), 115 OPT_UNCONDITIONAL = (1 << 3), 116 OPT_VERBOSE = (1 << 4), 117 OPT_CREATE_LEADING_DIR = (1 << 5), 118 OPT_PRESERVE_MTIME = (1 << 6), 119 OPT_DEREF = (1 << 7), 120 OPT_FILE = (1 << 8), 91 121 OPTBIT_FILE = 8, 92 122 IF_FEATURE_CPIO_O(OPTBIT_CREATE ,) … … 95 125 IF_LONG_OPTS( OPTBIT_QUIET ,) 96 126 IF_LONG_OPTS( OPTBIT_2STDOUT ,) 97 CPIO_OPT_CREATE = IF_FEATURE_CPIO_O((1 << OPTBIT_CREATE )) + 0,98 CPIO_OPT_FORMAT = IF_FEATURE_CPIO_O((1 << OPTBIT_FORMAT )) + 0,99 CPIO_OPT_PASSTHROUGH = IF_FEATURE_CPIO_P((1 << OPTBIT_PASSTHROUGH)) + 0,100 CPIO_OPT_QUIET = IF_LONG_OPTS( (1 << OPTBIT_QUIET )) + 0,101 CPIO_OPT_2STDOUT = IF_LONG_OPTS( (1 << OPTBIT_2STDOUT )) + 0,127 OPT_CREATE = IF_FEATURE_CPIO_O((1 << OPTBIT_CREATE )) + 0, 128 OPT_FORMAT = IF_FEATURE_CPIO_O((1 << OPTBIT_FORMAT )) + 0, 129 OPT_PASSTHROUGH = IF_FEATURE_CPIO_P((1 << OPTBIT_PASSTHROUGH)) + 0, 130 OPT_QUIET = IF_LONG_OPTS( (1 << OPTBIT_QUIET )) + 0, 131 OPT_2STDOUT = IF_LONG_OPTS( (1 << OPTBIT_2STDOUT )) + 0, 102 132 }; 103 133 … … 139 169 struct stat st; 140 170 141 line = (option_mask32 & CPIO_OPT_NUL_TERMINATED)171 line = (option_mask32 & OPT_NUL_TERMINATED) 142 172 ? bb_get_chunk_from_file(stdin, NULL) 143 173 : xmalloc_fgetline(stdin); … … 154 184 continue; 155 185 } 156 if ((option_mask32 & CPIO_OPT_DEREF)186 if ((option_mask32 & OPT_DEREF) 157 187 ? stat(name, &st) 158 188 : lstat(name, &st) … … 224 254 225 255 bytes += printf("070701" 226 227 256 "%08X%08X%08X%08X%08X%08X%08X" 257 "%08X%08X%08X%08X" /* GNU cpio uses uppercase hex */ 228 258 /* strlen+1: */ "%08X" 229 259 /* chksum: */ "00000000" /* (only for "070702" files) */ 230 260 /* name,NUL: */ "%s%c", 231 232 233 234 235 236 237 238 239 240 241 242 243 261 (unsigned)(uint32_t) st.st_ino, 262 (unsigned)(uint32_t) st.st_mode, 263 (unsigned)(uint32_t) st.st_uid, 264 (unsigned)(uint32_t) st.st_gid, 265 (unsigned)(uint32_t) st.st_nlink, 266 (unsigned)(uint32_t) st.st_mtime, 267 (unsigned)(uint32_t) st.st_size, 268 (unsigned)(uint32_t) major(st.st_dev), 269 (unsigned)(uint32_t) minor(st.st_dev), 270 (unsigned)(uint32_t) major(st.st_rdev), 271 (unsigned)(uint32_t) minor(st.st_rdev), 272 (unsigned)(strlen(name) + 1), 273 name, '\0'); 244 274 bytes = cpio_pad4(bytes); 245 275 … … 311 341 opt = getopt32(argv, OPTION_STR, &cpio_filename); 312 342 argv += optind; 313 if (opt & CPIO_OPT_FILE) { /* -F */343 if (opt & OPT_FILE) { /* -F */ 314 344 xmove_fd(xopen(cpio_filename, O_RDONLY), STDIN_FILENO); 315 345 } … … 317 347 opt = getopt32(argv, OPTION_STR "oH:" IF_FEATURE_CPIO_P("p"), &cpio_filename, &cpio_fmt); 318 348 argv += optind; 319 if ((opt & ( CPIO_OPT_FILE|CPIO_OPT_CREATE)) == CPIO_OPT_FILE) { /* -F without -o */349 if ((opt & (OPT_FILE|OPT_CREATE)) == OPT_FILE) { /* -F without -o */ 320 350 xmove_fd(xopen(cpio_filename, O_RDONLY), STDIN_FILENO); 321 351 } 322 if (opt & CPIO_OPT_PASSTHROUGH) {352 if (opt & OPT_PASSTHROUGH) { 323 353 pid_t pid; 324 354 struct fd_pair pp; … … 326 356 if (argv[0] == NULL) 327 357 bb_show_usage(); 328 if (opt & CPIO_OPT_CREATE_LEADING_DIR)358 if (opt & OPT_CREATE_LEADING_DIR) 329 359 mkdir(argv[0], 0777); 330 360 /* Crude existence check: … … 355 385 } 356 386 /* parent */ 387 USE_FOR_NOMMU(argv[-optind][0] &= 0x7f); /* undo fork_or_rexec() damage */ 357 388 xchdir(*argv++); 358 389 close(pp.wr); 359 390 xmove_fd(pp.rd, STDIN_FILENO); 360 //opt &= ~ CPIO_OPT_PASSTHROUGH;361 opt |= CPIO_OPT_EXTRACT;391 //opt &= ~OPT_PASSTHROUGH; 392 opt |= OPT_EXTRACT; 362 393 goto skip; 363 394 } 364 395 /* -o */ 365 if (opt & CPIO_OPT_CREATE) {396 if (opt & OPT_CREATE) { 366 397 if (cpio_fmt[0] != 'n') /* we _require_ "-H newc" */ 367 398 bb_show_usage(); 368 if (opt & CPIO_OPT_FILE) {399 if (opt & OPT_FILE) { 369 400 xmove_fd(xopen(cpio_filename, O_WRONLY | O_CREAT | O_TRUNC), STDOUT_FILENO); 370 401 } … … 376 407 377 408 /* One of either extract or test options must be given */ 378 if ((opt & ( CPIO_OPT_TEST | CPIO_OPT_EXTRACT)) == 0) {409 if ((opt & (OPT_TEST | OPT_EXTRACT)) == 0) { 379 410 bb_show_usage(); 380 411 } 381 412 382 if (opt & CPIO_OPT_TEST) {413 if (opt & OPT_TEST) { 383 414 /* if both extract and test options are given, ignore extract option */ 384 opt &= ~ CPIO_OPT_EXTRACT;415 opt &= ~OPT_EXTRACT; 385 416 archive_handle->action_header = header_list; 386 417 } 387 if (opt & CPIO_OPT_EXTRACT) {418 if (opt & OPT_EXTRACT) { 388 419 archive_handle->action_data = data_extract_all; 389 if (opt & CPIO_OPT_2STDOUT)420 if (opt & OPT_2STDOUT) 390 421 archive_handle->action_data = data_extract_to_stdout; 391 422 } 392 if (opt & CPIO_OPT_UNCONDITIONAL) {423 if (opt & OPT_UNCONDITIONAL) { 393 424 archive_handle->ah_flags |= ARCHIVE_UNLINK_OLD; 394 425 archive_handle->ah_flags &= ~ARCHIVE_EXTRACT_NEWER; 395 426 } 396 if (opt & CPIO_OPT_VERBOSE) {427 if (opt & OPT_VERBOSE) { 397 428 if (archive_handle->action_header == header_list) { 398 429 archive_handle->action_header = header_verbose_list; … … 401 432 } 402 433 } 403 if (opt & CPIO_OPT_CREATE_LEADING_DIR) {434 if (opt & OPT_CREATE_LEADING_DIR) { 404 435 archive_handle->ah_flags |= ARCHIVE_CREATE_LEADING_DIRS; 405 436 } 406 if (opt & CPIO_OPT_PRESERVE_MTIME) {437 if (opt & OPT_PRESERVE_MTIME) { 407 438 archive_handle->ah_flags |= ARCHIVE_RESTORE_DATE; 408 439 } … … 420 451 421 452 if (archive_handle->cpio__blocks != (off_t)-1 422 && !(opt & CPIO_OPT_QUIET)453 && !(opt & OPT_QUIET) 423 454 ) { 424 455 fprintf(stderr, "%"OFF_FMT"u blocks\n", archive_handle->cpio__blocks); -
branches/3.2/mindi-busybox/archival/dpkg.c
r2725 r3232 29 29 */ 30 30 31 //usage:#define dpkg_trivial_usage 32 //usage: "[-ilCPru] [-F OPT] PACKAGE" 33 //usage:#define dpkg_full_usage "\n\n" 34 //usage: "Install, remove and manage Debian packages\n" 35 //usage: IF_LONG_OPTS( 36 //usage: "\n -i,--install Install the package" 37 //usage: "\n -l,--list List of installed packages" 38 //usage: "\n --configure Configure an unpackaged package" 39 //usage: "\n -P,--purge Purge all files of a package" 40 //usage: "\n -r,--remove Remove all but the configuration files for a package" 41 //usage: "\n --unpack Unpack a package, but don't configure it" 42 //usage: "\n --force-depends Ignore dependency problems" 43 //usage: "\n --force-confnew Overwrite existing config files when installing" 44 //usage: "\n --force-confold Keep old config files when installing" 45 //usage: ) 46 //usage: IF_NOT_LONG_OPTS( 47 //usage: "\n -i Install the package" 48 //usage: "\n -l List of installed packages" 49 //usage: "\n -C Configure an unpackaged package" 50 //usage: "\n -P Purge all files of a package" 51 //usage: "\n -r Remove all but the configuration files for a package" 52 //usage: "\n -u Unpack a package, but don't configure it" 53 //usage: "\n -F depends Ignore dependency problems" 54 //usage: "\n -F confnew Overwrite existing config files when installing" 55 //usage: "\n -F confold Keep old config files when installing" 56 //usage: ) 57 31 58 #include "libbb.h" 32 59 #include <fnmatch.h> 33 #include " archive.h"60 #include "bb_archive.h" 34 61 35 62 /* note: if you vary hash_prime sizes be aware, … … 675 702 static void set_status(const unsigned status_node_num, const char *new_value, const int position) 676 703 { 677 const unsigned new_value_len = strlen(new_value);678 704 const unsigned new_value_num = search_name_hashtable(new_value); 679 705 unsigned want = get_status(status_node_num, 1); 680 706 unsigned flag = get_status(status_node_num, 2); 681 707 unsigned status = get_status(status_node_num, 3); 682 int want_len = strlen(name_hashtable[want]);683 int flag_len = strlen(name_hashtable[flag]);684 int status_len = strlen(name_hashtable[status]);685 708 char *new_status; 686 709 … … 688 711 case 1: 689 712 want = new_value_num; 690 want_len = new_value_len;691 713 break; 692 714 case 2: 693 715 flag = new_value_num; 694 flag_len = new_value_len;695 716 break; 696 717 case 3: 697 718 status = new_value_num; 698 status_len = new_value_len;699 719 break; 700 720 default: … … 1007 1027 const unsigned package_num = 1008 1028 search_package_hashtable(package_edge->name, 1009 1010 1029 package_edge->version, 1030 package_edge->operator); 1011 1031 int result = 0; 1012 1032 if (package_hashtable[package_num] != NULL) { … … 1095 1115 if (root_of_alternatives && package_edge->type != root_of_alternatives->type - 1) 1096 1116 bb_error_msg_and_die("fatal error, package dependencies corrupt: %d != %d - 1", 1097 1117 package_edge->type, root_of_alternatives->type); 1098 1118 1099 1119 if (package_hashtable[package_num] != NULL) … … 1646 1666 init_archive_deb_data(archive_handle); 1647 1667 archive_handle->dpkg__sub_archive->accept = conffile_list; 1668 /* Why ARCHIVE_REMEMBER_NAMES? 1669 * We want names collected in ->passed list even if conffile_list 1670 * is NULL (otherwise get_header_tar may optimize name saving out): 1671 */ 1672 archive_handle->dpkg__sub_archive->ah_flags |= ARCHIVE_REMEMBER_NAMES | ARCHIVE_UNLINK_OLD; 1648 1673 archive_handle->dpkg__sub_archive->filter = filter_rename_config; 1649 1674 archive_handle->dpkg__sub_archive->action_data = data_extract_all_prefix; 1650 1675 archive_handle->dpkg__sub_archive->dpkg__buffer = (char*)"/"; /* huh? */ 1651 archive_handle->dpkg__sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD;1652 1676 unpack_ar_archive(archive_handle); 1653 1677 … … 1655 1679 list_filename = xasprintf("/var/lib/dpkg/info/%s.%s", package_name, "list"); 1656 1680 out_stream = xfopen_for_write(list_filename); 1681 archive_handle->dpkg__sub_archive->passed = llist_rev(archive_handle->dpkg__sub_archive->passed); 1657 1682 while (archive_handle->dpkg__sub_archive->passed) { 1683 char *filename = llist_pop(&archive_handle->dpkg__sub_archive->passed); 1658 1684 /* the leading . has been stripped by data_extract_all_prefix already */ 1659 fputs(archive_handle->dpkg__sub_archive->passed->data, out_stream); 1660 fputc('\n', out_stream); 1661 archive_handle->dpkg__sub_archive->passed = archive_handle->dpkg__sub_archive->passed->link; 1685 fprintf(out_stream, "%s\n", filename); 1686 free(filename); 1662 1687 } 1663 1688 fclose(out_stream); -
branches/3.2/mindi-busybox/archival/dpkg_deb.c
r2725 r3232 5 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 6 */ 7 8 //usage:#define dpkg_deb_trivial_usage 9 //usage: "[-cefxX] FILE [argument" 10 //usage:#define dpkg_deb_full_usage "\n\n" 11 //usage: "Perform actions on Debian packages (.debs)\n" 12 //usage: "\n -c List contents of filesystem tree" 13 //usage: "\n -e Extract control files to [argument] directory" 14 //usage: "\n -f Display control field name starting with [argument]" 15 //usage: "\n -x Extract packages filesystem tree to directory" 16 //usage: "\n -X Verbose extract" 17 //usage: 18 //usage:#define dpkg_deb_example_usage 19 //usage: "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" 20 7 21 #include "libbb.h" 8 #include " archive.h"22 #include "bb_archive.h" 9 23 10 24 #define DPKG_DEB_OPT_CONTENTS 1 -
branches/3.2/mindi-busybox/archival/gzip.c
r2725 r3232 40 40 */ 41 41 42 //usage:#define gzip_trivial_usage 43 //usage: "[-cfd] [FILE]..." 44 //usage:#define gzip_full_usage "\n\n" 45 //usage: "Compress FILEs (or stdin)\n" 46 //usage: "\n -d Decompress" 47 //usage: "\n -c Write to stdout" 48 //usage: "\n -f Force" 49 //usage: 50 //usage:#define gzip_example_usage 51 //usage: "$ ls -la /tmp/busybox*\n" 52 //usage: "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/busybox.tar\n" 53 //usage: "$ gzip /tmp/busybox.tar\n" 54 //usage: "$ ls -la /tmp/busybox*\n" 55 //usage: "-rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/busybox.tar.gz\n" 56 42 57 #include "libbb.h" 43 #include " archive.h"58 #include "bb_archive.h" 44 59 45 60 … … 67 82 /* =========================================================================== 68 83 */ 69 #define SMALL_MEM 84 #if CONFIG_GZIP_FAST == 0 85 # define SMALL_MEM 86 #elif CONFIG_GZIP_FAST == 1 87 # define MEDIUM_MEM 88 #elif CONFIG_GZIP_FAST == 2 89 # define BIG_MEM 90 #else 91 # error "Invalid CONFIG_GZIP_FAST value" 92 #endif 70 93 71 94 #ifndef INBUFSIZ … … 1157 1180 */ 1158 1181 Assert(code + G2.bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1, 1159 1182 "inconsistent bit counts"); 1160 1183 Tracev((stderr, "\ngen_codes: max_code %d ", max_code)); 1161 1184 … … 1505 1528 out_length >>= 3; 1506 1529 Trace((stderr, 1507 1508 1509 1530 "\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) ", 1531 G2.last_lit, G2.last_dist, in_length, out_length, 1532 100L - out_length * 100L / in_length)); 1510 1533 if (G2.last_dist < G2.last_lit / 2 && out_length < in_length / 2) 1511 1534 return 1; … … 1599 1622 1600 1623 Trace((stderr, 1601 1602 1603 1624 "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u ", 1625 opt_lenb, G2.opt_len, static_lenb, G2.static_len, stored_len, 1626 G2.last_lit, G2.last_dist)); 1604 1627 1605 1628 if (static_lenb <= opt_lenb) … … 1639 1662 send_bits((DYN_TREES << 1) + eof, 3); 1640 1663 send_all_trees(G2.l_desc.max_code + 1, G2.d_desc.max_code + 1, 1641 1664 max_blindex + 1); 1642 1665 compress_block((ct_data *) G2.dyn_ltree, (ct_data *) G2.dyn_dtree); 1643 1666 G2.compressed_len += 3 + G2.opt_len; … … 1659 1682 /* =========================================================================== 1660 1683 * Update a hash value with the given input byte 1661 * IN assertion: all calls to toUPDATE_HASH are made with consecutive1684 * IN assertion: all calls to UPDATE_HASH are made with consecutive 1662 1685 * input characters, so that a running hash key can be computed from the 1663 1686 * previous key instead of complete recalculation each time. … … 1690 1713 * of the hash chain (the most recent string with same hash key). Return 1691 1714 * the previous length of the hash chain. 1692 * IN assertion: all calls to toINSERT_STRING are made with consecutive1715 * IN assertion: all calls to INSERT_STRING are made with consecutive 1693 1716 * input characters and the first MIN_MATCH bytes of s are valid 1694 1717 * (except for the last MIN_MATCH-1 bytes of the input file). */ … … 1993 2016 /* ======================================================================== */ 1994 2017 static 1995 IF_DESKTOP(long long) int FAST_FUNC pack_gzip( unpack_info_t *infoUNUSED_PARAM)2018 IF_DESKTOP(long long) int FAST_FUNC pack_gzip(transformer_aux_data_t *aux UNUSED_PARAM) 1996 2019 { 1997 2020 struct stat s; -
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 -
branches/3.2/mindi-busybox/archival/lzop.c
r2725 r3232 15 15 This program is distributed in the hope that it will be useful, 16 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 18 GNU General Public License for more details. 19 19 … … 26 26 */ 27 27 28 //usage:#define lzop_trivial_usage 29 //usage: "[-cfvd123456789CF] [FILE]..." 30 //usage:#define lzop_full_usage "\n\n" 31 //usage: " -1..9 Compression level" 32 //usage: "\n -d Decompress" 33 //usage: "\n -c Write to stdout" 34 //usage: "\n -f Force" 35 //usage: "\n -v Verbose" 36 //usage: "\n -F Don't store or verify checksum" 37 //usage: "\n -C Also write checksum of compressed block" 38 //usage: 39 //usage:#define lzopcat_trivial_usage 40 //usage: "[-vCF] [FILE]..." 41 //usage:#define lzopcat_full_usage "\n\n" 42 //usage: " -v Verbose" 43 //usage: "\n -F Don't store or verify checksum" 44 //usage: 45 //usage:#define unlzop_trivial_usage 46 //usage: "[-cfvCF] [FILE]..." 47 //usage:#define unlzop_full_usage "\n\n" 48 //usage: " -c Write to stdout" 49 //usage: "\n -f Force" 50 //usage: "\n -v Verbose" 51 //usage: "\n -F Don't store or verify checksum" 52 28 53 #include "libbb.h" 29 #include " archive.h"54 #include "bb_archive.h" 30 55 #include "liblzo_interface.h" 31 56 … … 92 117 unsigned long o_m1_a = 0, o_m1_b = 0, o_m2 = 0, o_m3_a = 0, o_m3_b = 0; 93 118 94 // 119 // LZO_UNUSED(wrkmem); 95 120 96 121 *out_len = 0; … … 177 202 *litp &= ~3; 178 203 /* copy over the 2 literals that replace the match */ 179 copy2(ip-3+1, m_pos,pd(op,m_pos));204 copy2(ip-3+1, m_pos, pd(op, m_pos)); 180 205 /* move literals 1 byte ahead */ 181 206 litp += 2; … … 187 212 188 213 o_m1_b++; 189 *op++ = *m_pos++; *op++ = *m_pos++; 214 *op++ = *m_pos++; 215 *op++ = *m_pos++; 190 216 goto copy_literal_run; 191 217 } … … 216 242 t = *ip++; 217 243 /* copy over the 3 literals that replace the match */ 218 copy3(ip-1-2, m_pos,pd(op,m_pos));244 copy3(ip-1-2, m_pos, pd(op, m_pos)); 219 245 /* set new length of previous literal run */ 220 246 lit += 3 + t + 3; … … 265 291 *litp = (unsigned char)((*litp & ~3) | lit); 266 292 /* copy over the 3 literals that replace the match */ 267 copy3(ip-3, m_pos,pd(op,m_pos));293 copy3(ip-3, m_pos, pd(op, m_pos)); 268 294 o_m3_a++; 269 295 } … … 276 302 *litp &= ~3; 277 303 /* copy over the 3 literals that replace the match */ 278 copy3(ip-4+1, m_pos,pd(op,m_pos));304 copy3(ip-4+1, m_pos, pd(op, m_pos)); 279 305 /* move literals 1 byte ahead */ 280 306 litp += 2; … … 321 347 322 348 eof_found: 323 // 324 // 349 // LZO_UNUSED(o_m1_a); LZO_UNUSED(o_m1_b); LZO_UNUSED(o_m2); 350 // LZO_UNUSED(o_m3_a); LZO_UNUSED(o_m3_b); 325 351 *out_len = pd(op, out); 326 352 return (ip == ip_end ? LZO_E_OK : 327 (ip < ip_end? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));353 (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); 328 354 } 329 355 … … 402 428 //#define G (*ptr_to_globals) 403 429 //#define INIT_G() do { 404 // 430 // SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); 405 431 //} while (0) 406 432 … … 1052 1078 } 1053 1079 1054 static IF_DESKTOP(long long) int FAST_FUNC pack_lzop( unpack_info_t *infoUNUSED_PARAM)1080 static IF_DESKTOP(long long) int FAST_FUNC pack_lzop(transformer_aux_data_t *aux UNUSED_PARAM) 1055 1081 { 1056 1082 if (option_mask32 & OPT_DECOMPRESS) -
branches/3.2/mindi-busybox/archival/rpm.c
r2725 r3232 8 8 */ 9 9 10 //usage:#define rpm_trivial_usage 11 //usage: "-i PACKAGE.rpm; rpm -qp[ildc] PACKAGE.rpm" 12 //usage:#define rpm_full_usage "\n\n" 13 //usage: "Manipulate RPM packages\n" 14 //usage: "\nCommands:" 15 //usage: "\n -i Install package" 16 //usage: "\n -qp Query package" 17 //usage: "\n -i Show information" 18 //usage: "\n -l List contents" 19 //usage: "\n -d List documents" 20 //usage: "\n -c List config files" 21 10 22 #include "libbb.h" 11 #include " archive.h"23 #include "bb_archive.h" 12 24 #include "rpm.h" 13 25 … … 225 237 /*archive_handle->offset = 0; - init_handle() did it */ 226 238 227 setup_unzip_on_fd(archive_handle->src_fd /*, fail_if_not_detected: 1*/);239 setup_unzip_on_fd(archive_handle->src_fd, /*fail_if_not_detected:*/ 1); 228 240 while (get_header_cpio(archive_handle) == EXIT_SUCCESS) 229 241 continue; -
branches/3.2/mindi-busybox/archival/rpm2cpio.c
r2725 r3232 7 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 10 //usage:#define rpm2cpio_trivial_usage 11 //usage: "package.rpm" 12 //usage:#define rpm2cpio_full_usage "\n\n" 13 //usage: "Output a cpio archive of the rpm file" 14 9 15 #include "libbb.h" 10 #include " archive.h"16 #include "bb_archive.h" 11 17 #include "rpm.h" 12 18 … … 61 67 skip_header(); 62 68 63 #if 0 69 //if (SEAMLESS_COMPRESSION) 70 // /* We need to know whether child (gzip/bzip/etc) exits abnormally */ 71 // signal(SIGCHLD, check_errors_in_children); 72 64 73 /* This works, but doesn't report uncompress errors (they happen in child) */ 65 setup_unzip_on_fd(rpm_fd /*fail_if_not_detected: 1*/);74 setup_unzip_on_fd(rpm_fd, /*fail_if_not_detected:*/ 1); 66 75 if (bb_copyfd_eof(rpm_fd, STDOUT_FILENO) < 0) 67 76 bb_error_msg_and_die("error unpacking"); 68 #else69 /* BLOAT */70 {71 union {72 uint8_t b[4];73 uint16_t b16[2];74 uint32_t b32[1];75 } magic;76 IF_DESKTOP(long long) int FAST_FUNC (*unpack)(int src_fd, int dst_fd);77 78 xread(rpm_fd, magic.b16, sizeof(magic.b16[0]));79 if (magic.b16[0] == GZIP_MAGIC) {80 unpack = unpack_gz_stream;81 } else82 if (ENABLE_FEATURE_SEAMLESS_BZ283 && magic.b16[0] == BZIP2_MAGIC84 ) {85 unpack = unpack_bz2_stream;86 } else87 if (ENABLE_FEATURE_SEAMLESS_XZ88 && magic.b16[0] == XZ_MAGIC189 ) {90 xread(rpm_fd, magic.b32, sizeof(magic.b32[0]));91 if (magic.b32[0] != XZ_MAGIC2)92 goto no_magic;93 /* unpack_xz_stream wants fd at position 6, no need to seek */94 //xlseek(rpm_fd, -6, SEEK_CUR);95 unpack = unpack_xz_stream;96 } else {97 no_magic:98 bb_error_msg_and_die("no gzip"99 IF_FEATURE_SEAMLESS_BZ2("/bzip2")100 IF_FEATURE_SEAMLESS_XZ("/xz")101 " magic");102 }103 if (unpack(rpm_fd, STDOUT_FILENO) < 0)104 bb_error_msg_and_die("error unpacking");105 }106 #endif107 77 108 78 if (ENABLE_FEATURE_CLEAN_UP) { … … 110 80 } 111 81 112 return 0; 82 if (SEAMLESS_COMPRESSION) { 83 check_errors_in_children(0); 84 return bb_got_signal; 85 } 86 return EXIT_SUCCESS; 113 87 } -
branches/3.2/mindi-busybox/archival/tar.c
r2725 r3232 24 24 */ 25 25 26 /* TODO: security with -C DESTDIR option can be enhanced. 27 * Consider tar file created via: 28 * $ tar cvf bug.tar anything.txt 29 * $ ln -s /tmp symlink 30 * $ tar --append -f bug.tar symlink 31 * $ rm symlink 32 * $ mkdir symlink 33 * $ tar --append -f bug.tar symlink/evil.py 34 * 35 * This will result in an archive which contains: 36 * $ tar --list -f bug.tar 37 * anything.txt 38 * symlink 39 * symlink/evil.py 40 * 41 * Untarring it puts evil.py in '/tmp' even if the -C DESTDIR is given. 42 * This doesn't feel right, and IIRC GNU tar doesn't do that. 43 */ 44 26 45 #include <fnmatch.h> 27 46 #include "libbb.h" 28 #include " archive.h"47 #include "bb_archive.h" 29 48 /* FIXME: Stop using this non-standard feature */ 30 49 #ifndef FNM_LEADING_DIR … … 42 61 #if !ENABLE_FEATURE_SEAMLESS_GZ && !ENABLE_FEATURE_SEAMLESS_BZ2 43 62 /* Do not pass gzip flag to writeTarFile() */ 44 #define writeTarFile(tar_fd, verboseFlag, dereferenceFlag, include, exclude, gzip) \45 writeTarFile(tar_fd, verboseFlag, dereferenceFlag, include, exclude)63 #define writeTarFile(tar_fd, verboseFlag, recurseFlags, include, exclude, gzip) \ 64 writeTarFile(tar_fd, verboseFlag, recurseFlags, include, exclude) 46 65 #endif 47 66 … … 246 265 PUT_OCTAL(header.gid, statbuf->st_gid); 247 266 memset(header.size, '0', sizeof(header.size)-1); /* Regular file size is handled later */ 248 PUT_OCTAL(header.mtime, statbuf->st_mtime); 267 /* users report that files with negative st_mtime cause trouble, so: */ 268 PUT_OCTAL(header.mtime, statbuf->st_mtime >= 0 ? statbuf->st_mtime : 0); 249 269 250 270 /* Enter the user and group names */ … … 298 318 header.typeflag = FIFOTYPE; 299 319 } else if (S_ISREG(statbuf->st_mode)) { 300 if (sizeof(statbuf->st_size) > 4 301 && statbuf->st_size > (off_t)0777777777777LL 320 /* header.size field is 12 bytes long */ 321 /* Does octal-encoded size fit? */ 322 uoff_t filesize = statbuf->st_size; 323 if (sizeof(filesize) <= 4 324 || filesize <= (uoff_t)0777777777777LL 302 325 ) { 326 PUT_OCTAL(header.size, filesize); 327 } 328 /* Does base256-encoded size fit? 329 * It always does unless off_t is wider than 64 bits. 330 */ 331 else if (ENABLE_FEATURE_TAR_GNU_EXTENSIONS 332 #if ULLONG_MAX > 0xffffffffffffffffLL /* 2^64-1 */ 333 && (filesize <= 0x3fffffffffffffffffffffffLL) 334 #endif 335 ) { 336 /* GNU tar uses "base-256 encoding" for very large numbers. 337 * Encoding is binary, with highest bit always set as a marker 338 * and sign in next-highest bit: 339 * 80 00 .. 00 - zero 340 * bf ff .. ff - largest positive number 341 * ff ff .. ff - minus 1 342 * c0 00 .. 00 - smallest negative number 343 */ 344 char *p8 = header.size + sizeof(header.size); 345 do { 346 *--p8 = (uint8_t)filesize; 347 filesize >>= 8; 348 } while (p8 != header.size); 349 *p8 |= 0x80; 350 } else { 303 351 bb_error_msg_and_die("can't store file '%s' " 304 352 "of size %"OFF_FMT"u, aborting", … … 306 354 } 307 355 header.typeflag = REGTYPE; 308 PUT_OCTAL(header.size, statbuf->st_size);309 356 } else { 310 357 bb_error_msg("%s: unknown file type", fileName); … … 379 426 DBG("writeFileToTarball('%s')", fileName); 380 427 381 /* Strip leading '/' (must be before memorizing hardlink's name) */ 382 header_name = fileName; 383 while (header_name[0] == '/') { 384 static smallint warned; 385 386 if (!warned) { 387 bb_error_msg("removing leading '/' from member names"); 388 warned = 1; 389 } 390 header_name++; 391 } 428 /* Strip leading '/' and such (must be before memorizing hardlink's name) */ 429 header_name = strip_unsafe_prefix(fileName); 392 430 393 431 if (header_name[0] == '\0') … … 561 599 /* gcc 4.2.1 inlines it, making code bigger */ 562 600 static NOINLINE int writeTarFile(int tar_fd, int verboseFlag, 563 int dereferenceFlag, const llist_t *include,601 int recurseFlags, const llist_t *include, 564 602 const llist_t *exclude, int gzip) 565 603 { … … 584 622 /* Read the directory/files and iterate over them one at a time */ 585 623 while (include) { 586 if (!recursive_action(include->data, ACTION_RECURSE | 587 (dereferenceFlag ? ACTION_FOLLOWLINKS : 0), 624 if (!recursive_action(include->data, recurseFlags, 588 625 writeFileToTarball, writeFileToTarball, &tbInfo, 0) 589 626 ) { … … 625 662 #else 626 663 int writeTarFile(int tar_fd, int verboseFlag, 627 int dereferenceFlag, const llist_t *include,664 int recurseFlags, const llist_t *include, 628 665 const llist_t *exclude, int gzip); 629 666 #endif /* FEATURE_TAR_CREATE */ … … 637 674 638 675 while (list) { 639 src_stream = xfopen_ for_read(llist_pop(&list));676 src_stream = xfopen_stdin(llist_pop(&list)); 640 677 while ((line = xmalloc_fgetline(src_stream)) != NULL) { 641 678 /* kill trailing '/' unless the string is just "/" */ … … 653 690 #endif 654 691 655 #if ENABLE_FEATURE_SEAMLESS_Z656 static char FAST_FUNC get_header_tar_Z(archive_handle_t *archive_handle)657 {658 /* Can't lseek over pipes */659 archive_handle->seek = seek_by_read;660 661 /* do the decompression, and cleanup */662 if (xread_char(archive_handle->src_fd) != 0x1f663 || xread_char(archive_handle->src_fd) != 0x9d664 ) {665 bb_error_msg_and_die("invalid magic");666 }667 668 open_transformer(archive_handle->src_fd, unpack_Z_stream, "uncompress");669 archive_handle->offset = 0;670 while (get_header_tar(archive_handle) == EXIT_SUCCESS)671 continue;672 673 /* Can only do one file at a time */674 return EXIT_FAILURE;675 }676 #else677 # define get_header_tar_Z NULL678 #endif679 680 #ifdef CHECK_FOR_CHILD_EXITCODE681 /* Looks like it isn't needed - tar detects malformed (truncated)682 * archive if e.g. bunzip2 fails */683 static int child_error;684 685 static void handle_SIGCHLD(int status)686 {687 /* Actually, 'status' is a signo. We reuse it for other needs */688 689 /* Wait for any child without blocking */690 if (wait_any_nohang(&status) < 0)691 /* wait failed?! I'm confused... */692 return;693 694 if (WIFEXITED(status) && WEXITSTATUS(status) == 0)695 /* child exited with 0 */696 return;697 /* Cannot happen?698 if (!WIFSIGNALED(status) && !WIFEXITED(status)) return; */699 child_error = 1;700 }701 #endif702 703 692 //usage:#define tar_trivial_usage 704 //usage: "-[" IF_FEATURE_TAR_CREATE("c") "xt" IF_FEATURE_SEAMLESS_GZ("z") 705 //usage: IF_FEATURE_SEAMLESS_BZ2("j") IF_FEATURE_SEAMLESS_LZMA("a") 706 //usage: IF_FEATURE_SEAMLESS_Z("Z") IF_FEATURE_TAR_NOPRESERVE_TIME("m") "vO] " 707 //usage: IF_FEATURE_TAR_FROM("[-X FILE] ") 708 //usage: "[-f TARFILE] [-C DIR] [FILE]..." 693 //usage: "-[" IF_FEATURE_TAR_CREATE("c") "xt" 694 //usage: IF_FEATURE_SEAMLESS_Z("Z") 695 //usage: IF_FEATURE_SEAMLESS_GZ("z") 696 //usage: IF_FEATURE_SEAMLESS_XZ("J") 697 //usage: IF_FEATURE_SEAMLESS_BZ2("j") 698 //usage: IF_FEATURE_SEAMLESS_LZMA("a") 699 //usage: IF_FEATURE_TAR_CREATE("h") 700 //usage: IF_FEATURE_TAR_NOPRESERVE_TIME("m") 701 //usage: "vO] " 702 //usage: IF_FEATURE_TAR_FROM("[-X FILE] [-T FILE] ") 703 //usage: "[-f TARFILE] [-C DIR] [FILE]..." 709 704 //usage:#define tar_full_usage "\n\n" 710 705 //usage: IF_FEATURE_TAR_CREATE("Create, extract, ") … … 717 712 //usage: "\n x Extract" 718 713 //usage: "\n t List" 719 //usage: "\nOptions:"720 714 //usage: "\n f Name of TARFILE ('-' for stdin/out)" 721 715 //usage: "\n C Change to DIR before operation" 722 716 //usage: "\n v Verbose" 717 //usage: IF_FEATURE_SEAMLESS_Z( 718 //usage: "\n Z (De)compress using compress" 719 //usage: ) 723 720 //usage: IF_FEATURE_SEAMLESS_GZ( 724 721 //usage: "\n z (De)compress using gzip" 722 //usage: ) 723 //usage: IF_FEATURE_SEAMLESS_XZ( 724 //usage: "\n J (De)compress using xz" 725 725 //usage: ) 726 726 //usage: IF_FEATURE_SEAMLESS_BZ2( … … 729 729 //usage: IF_FEATURE_SEAMLESS_LZMA( 730 730 //usage: "\n a (De)compress using lzma" 731 //usage: )732 //usage: IF_FEATURE_SEAMLESS_Z(733 //usage: "\n Z (De)compress using compress"734 731 //usage: ) 735 732 //usage: "\n O Extract to stdout" … … 756 753 // p same-permissions 757 754 // k keep-old 755 // no-recursion 758 756 // numeric-owner 759 757 // no-same-permissions … … 772 770 IF_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,) 773 771 IF_FEATURE_SEAMLESS_GZ( OPTBIT_GZIP ,) 774 IF_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,) // 16th bit 772 IF_FEATURE_SEAMLESS_XZ( OPTBIT_XZ ,) // 16th bit 773 IF_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,) 775 774 IF_FEATURE_TAR_NOPRESERVE_TIME(OPTBIT_NOPRESERVE_TIME,) 776 775 #if ENABLE_FEATURE_TAR_LONG_OPTIONS 776 OPTBIT_NORECURSION, 777 777 IF_FEATURE_TAR_TO_COMMAND(OPTBIT_2COMMAND ,) 778 778 OPTBIT_NUMERIC_OWNER, … … 796 796 OPT_EXCLUDE_FROM = IF_FEATURE_TAR_FROM( (1 << OPTBIT_EXCLUDE_FROM)) + 0, // X 797 797 OPT_GZIP = IF_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z 798 OPT_XZ = IF_FEATURE_SEAMLESS_XZ( (1 << OPTBIT_XZ )) + 0, // J 798 799 OPT_COMPRESS = IF_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z 799 800 OPT_NOPRESERVE_TIME = IF_FEATURE_TAR_NOPRESERVE_TIME((1 << OPTBIT_NOPRESERVE_TIME)) + 0, // m 801 OPT_NORECURSION = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NORECURSION )) + 0, // no-recursion 800 802 OPT_2COMMAND = IF_FEATURE_TAR_TO_COMMAND( (1 << OPTBIT_2COMMAND )) + 0, // to-command 801 803 OPT_NUMERIC_OWNER = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NUMERIC_OWNER )) + 0, // numeric-owner 802 804 OPT_NOPRESERVE_PERM = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_NOPRESERVE_PERM)) + 0, // no-same-permissions 803 805 OPT_OVERWRITE = IF_FEATURE_TAR_LONG_OPTIONS((1 << OPTBIT_OVERWRITE )) + 0, // overwrite 806 807 OPT_ANY_COMPRESS = (OPT_BZIP2 | OPT_LZMA | OPT_GZIP | OPT_XZ | OPT_COMPRESS), 804 808 }; 805 809 #if ENABLE_FEATURE_TAR_LONG_OPTIONS … … 834 838 "gzip\0" No_argument "z" 835 839 # endif 840 # if ENABLE_FEATURE_SEAMLESS_XZ 841 "xz\0" No_argument "J" 842 # endif 836 843 # if ENABLE_FEATURE_SEAMLESS_Z 837 844 "compress\0" No_argument "Z" … … 840 847 "touch\0" No_argument "m" 841 848 # endif 849 "no-recursion\0" No_argument "\xfa" 842 850 # if ENABLE_FEATURE_TAR_TO_COMMAND 843 851 "to-command\0" Required_argument "\xfb" … … 860 868 int tar_main(int argc UNUSED_PARAM, char **argv) 861 869 { 862 char FAST_FUNC (*get_header_ptr)(archive_handle_t *) = get_header_tar;863 870 archive_handle_t *tar_handle; 864 871 char *base_dir = NULL; … … 883 890 opt_complementary = "--:" // first arg is options 884 891 "tt:vv:" // count -t,-v 885 "?:" // bail out with usage instead of error return 886 "X::T::" // cumulative lists 892 IF_FEATURE_TAR_FROM("X::T::") // cumulative lists 887 893 #if ENABLE_FEATURE_TAR_LONG_OPTIONS && ENABLE_FEATURE_TAR_FROM 888 894 "\xff::" // cumulative lists for --exclude … … 928 934 IF_FEATURE_TAR_FROM( "T:X:") 929 935 IF_FEATURE_SEAMLESS_GZ( "z" ) 936 IF_FEATURE_SEAMLESS_XZ( "J" ) 930 937 IF_FEATURE_SEAMLESS_Z( "Z" ) 931 938 IF_FEATURE_TAR_NOPRESERVE_TIME("m") … … 957 964 signal(SIGPIPE, SIG_IGN); 958 965 tar_handle->action_data = data_extract_to_command; 966 IF_FEATURE_TAR_TO_COMMAND(tar_handle->tar__to_command_shell = xstrdup(get_shell_name());) 959 967 } 960 968 … … 975 983 tar_handle->ah_flags |= ARCHIVE_O_TRUNC; 976 984 } 977 978 if (opt & OPT_GZIP)979 get_header_ptr = get_header_tar_gz;980 981 if (opt & OPT_BZIP2)982 get_header_ptr = get_header_tar_bz2;983 984 if (opt & OPT_LZMA)985 get_header_ptr = get_header_tar_lzma;986 987 if (opt & OPT_COMPRESS)988 get_header_ptr = get_header_tar_Z;989 985 990 986 if (opt & OPT_NOPRESERVE_TIME) … … 1040 1036 if (ENABLE_FEATURE_TAR_AUTODETECT 1041 1037 && flags == O_RDONLY 1042 && get_header_ptr == get_header_tar1038 && !(opt & OPT_ANY_COMPRESS) 1043 1039 ) { 1044 1040 tar_handle->src_fd = open_zipped(tar_filename); … … 1054 1050 xchdir(base_dir); 1055 1051 1056 #ifdef CHECK_FOR_CHILD_EXITCODE 1057 /* We need to know whether child (gzip/bzip/etc) exits abnormally */ 1058 signal(SIGCHLD, handle_SIGCHLD); 1059 #endif 1052 //if (SEAMLESS_COMPRESSION || OPT_COMPRESS) 1053 // /* We need to know whether child (gzip/bzip/etc) exits abnormally */ 1054 // signal(SIGCHLD, check_errors_in_children); 1060 1055 1061 1056 /* Create an archive */ … … 1069 1064 #endif 1070 1065 /* NB: writeTarFile() closes tar_handle->src_fd */ 1071 return writeTarFile(tar_handle->src_fd, verboseFlag, opt & OPT_DEREFERENCE, 1066 return writeTarFile(tar_handle->src_fd, verboseFlag, 1067 (opt & OPT_DEREFERENCE ? ACTION_FOLLOWLINKS : 0) 1068 | (opt & OPT_NORECURSION ? 0 : ACTION_RECURSE), 1072 1069 tar_handle->accept, 1073 1070 tar_handle->reject, zipMode); 1074 1071 } 1075 1072 1076 while (get_header_ptr(tar_handle) == EXIT_SUCCESS) 1073 if (opt & OPT_ANY_COMPRESS) { 1074 USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_aux_data_t *aux, int src_fd, int dst_fd);) 1075 USE_FOR_NOMMU(const char *xformer_prog;) 1076 1077 if (opt & OPT_COMPRESS) 1078 USE_FOR_MMU(xformer = unpack_Z_stream;) 1079 USE_FOR_NOMMU(xformer_prog = "uncompress";) 1080 if (opt & OPT_GZIP) 1081 USE_FOR_MMU(xformer = unpack_gz_stream;) 1082 USE_FOR_NOMMU(xformer_prog = "gunzip";) 1083 if (opt & OPT_BZIP2) 1084 USE_FOR_MMU(xformer = unpack_bz2_stream;) 1085 USE_FOR_NOMMU(xformer_prog = "bunzip2";) 1086 if (opt & OPT_LZMA) 1087 USE_FOR_MMU(xformer = unpack_lzma_stream;) 1088 USE_FOR_NOMMU(xformer_prog = "unlzma";) 1089 if (opt & OPT_XZ) 1090 USE_FOR_MMU(xformer = unpack_xz_stream;) 1091 USE_FOR_NOMMU(xformer_prog = "unxz";) 1092 1093 open_transformer_with_sig(tar_handle->src_fd, xformer, xformer_prog); 1094 /* Can't lseek over pipes */ 1095 tar_handle->seek = seek_by_read; 1096 /*tar_handle->offset = 0; - already is */ 1097 } 1098 1099 while (get_header_tar(tar_handle) == EXIT_SUCCESS) 1077 1100 continue; 1078 1101 … … 1090 1113 close(tar_handle->src_fd); 1091 1114 1115 if (SEAMLESS_COMPRESSION || OPT_COMPRESS) { 1116 check_errors_in_children(0); 1117 return bb_got_signal; 1118 } 1092 1119 return EXIT_SUCCESS; 1093 1120 } -
branches/3.2/mindi-busybox/archival/unzip.c
r2725 r3232 20 20 */ 21 21 22 //usage:#define unzip_trivial_usage 23 //usage: "[-lnopq] FILE[.zip] [FILE]... [-x FILE...] [-d DIR]" 24 //usage:#define unzip_full_usage "\n\n" 25 //usage: "Extract FILEs from ZIP archive\n" 26 //usage: "\n -l List contents (with -q for short form)" 27 //usage: "\n -n Never overwrite files (default: ask)" 28 //usage: "\n -o Overwrite" 29 //usage: "\n -p Print to stdout" 30 //usage: "\n -q Quiet" 31 //usage: "\n -x FILE Exclude FILEs" 32 //usage: "\n -d DIR Extract into DIR" 33 22 34 #include "libbb.h" 23 #include " archive.h"35 #include "bb_archive.h" 24 36 25 37 enum { … … 224 236 char *name = xstrdup(fn); 225 237 if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) { 226 bb_error_msg_and_die("exiting"); /* bb_make_directory is noisy */238 xfunc_die(); /* bb_make_directory is noisy */ 227 239 } 228 240 free(name); … … 238 250 } else { 239 251 /* Method 8 - inflate */ 240 inflate_unzip_result res; 241 if (inflate_unzip(&res, zip_header->formatted.cmpsize, zip_fd, dst_fd) < 0) 252 transformer_aux_data_t aux; 253 init_transformer_aux_data(&aux); 254 aux.bytes_in = zip_header->formatted.cmpsize; 255 if (inflate_unzip(&aux, zip_fd, dst_fd) < 0) 242 256 bb_error_msg_and_die("inflate error"); 243 257 /* Validate decompression - crc */ 244 if (zip_header->formatted.crc32 != ( res.crc^ 0xffffffffL)) {258 if (zip_header->formatted.crc32 != (aux.crc32 ^ 0xffffffffL)) { 245 259 bb_error_msg_and_die("crc error"); 246 260 } 247 261 /* Validate decompression - size */ 248 if (zip_header->formatted.ucmpsize != res.bytes_out) {262 if (zip_header->formatted.ucmpsize != aux.bytes_out) { 249 263 /* Don't die. Who knows, maybe len calculation 250 264 * was botched somewhere. After all, crc matched! */ … … 264 278 smallint listing = 0; 265 279 smallint overwrite = O_PROMPT; 280 smallint x_opt_seen; 266 281 #if ENABLE_DESKTOP 267 282 uint32_t cdf_offset; … … 277 292 char *base_dir = NULL; 278 293 int i, opt; 279 int opt_range = 0;280 294 char key_buf[80]; 281 295 struct stat stat_buf; … … 322 336 */ 323 337 338 x_opt_seen = 0; 324 339 /* '-' makes getopt return 1 for non-options */ 325 340 while ((opt = getopt(argc, argv, "-d:lnopqxv")) != -1) { 326 switch (opt_range) { 327 case 0: /* Options */ 328 switch (opt) { 329 case 'l': /* List */ 330 listing = 1; 331 break; 332 333 case 'n': /* Never overwrite existing files */ 334 overwrite = O_NEVER; 335 break; 336 337 case 'o': /* Always overwrite existing files */ 338 overwrite = O_ALWAYS; 339 break; 340 341 case 'p': /* Extract files to stdout and fall through to set verbosity */ 342 dst_fd = STDOUT_FILENO; 343 344 case 'q': /* Be quiet */ 345 quiet++; 346 break; 347 348 case 'v': /* Verbose list */ 349 IF_DESKTOP(verbose++;) 350 listing = 1; 351 break; 352 353 case 1: /* The zip file */ 341 switch (opt) { 342 case 'd': /* Extract to base directory */ 343 base_dir = optarg; 344 break; 345 346 case 'l': /* List */ 347 listing = 1; 348 break; 349 350 case 'n': /* Never overwrite existing files */ 351 overwrite = O_NEVER; 352 break; 353 354 case 'o': /* Always overwrite existing files */ 355 overwrite = O_ALWAYS; 356 break; 357 358 case 'p': /* Extract files to stdout and fall through to set verbosity */ 359 dst_fd = STDOUT_FILENO; 360 361 case 'q': /* Be quiet */ 362 quiet++; 363 break; 364 365 case 'v': /* Verbose list */ 366 IF_DESKTOP(verbose++;) 367 listing = 1; 368 break; 369 370 case 'x': 371 x_opt_seen = 1; 372 break; 373 374 case 1: 375 if (!src_fn) { 376 /* The zip file */ 354 377 /* +5: space for ".zip" and NUL */ 355 378 src_fn = xmalloc(strlen(optarg) + 5); 356 379 strcpy(src_fn, optarg); 357 opt_range++; 358 break; 359 360 default: 361 bb_show_usage(); 380 } else if (!x_opt_seen) { 381 /* Include files */ 382 llist_add_to(&zaccept, optarg); 383 } else { 384 /* Exclude files */ 385 llist_add_to(&zreject, optarg); 362 386 } 363 387 break; 364 365 case 1: /* Include files */366 if (opt == 1) {367 llist_add_to(&zaccept, optarg);368 break;369 }370 if (opt == 'd') {371 base_dir = optarg;372 opt_range += 2;373 break;374 }375 if (opt == 'x') {376 opt_range++;377 break;378 }379 bb_show_usage();380 381 case 2 : /* Exclude files */382 if (opt == 1) {383 llist_add_to(&zreject, optarg);384 break;385 }386 if (opt == 'd') { /* Extract to base directory */387 base_dir = optarg;388 opt_range++;389 break;390 }391 /* fall through */392 388 393 389 default: … … 396 392 } 397 393 398 if (src_fn == NULL) { 394 #ifndef __GLIBC__ 395 /* 396 * This code is needed for non-GNU getopt 397 * which doesn't understand "-" in option string. 398 * The -x option won't work properly in this case: 399 * "unzip a.zip q -x w e" will be interpreted as 400 * "unzip a.zip q w e -x" = "unzip a.zip q w e" 401 */ 402 argv += optind; 403 if (argv[0]) { 404 /* +5: space for ".zip" and NUL */ 405 src_fn = xmalloc(strlen(argv[0]) + 5); 406 strcpy(src_fn, argv[0]); 407 while (*++argv) 408 llist_add_to(&zaccept, *argv); 409 } 410 #endif 411 412 if (!src_fn) { 399 413 bb_show_usage(); 400 414 } … … 407 421 overwrite = O_NEVER; 408 422 } else { 409 static const char extn[][5] = { "", ".zip", ".ZIP"};410 int orig_src_fn_len =strlen(src_fn);411 int src_fd = -1;412 413 for (i = 0; (i < 3) && (src_fd == -1); i++) {414 strcpy(src_fn + orig_src_fn_len, extn[i]);423 static const char extn[][5] = { ".zip", ".ZIP" }; 424 char *ext = src_fn + strlen(src_fn); 425 int src_fd; 426 427 i = 0; 428 for (;;) { 415 429 src_fd = open(src_fn, O_RDONLY); 416 } 417 if (src_fd == -1) { 418 src_fn[orig_src_fn_len] = '\0'; 419 bb_error_msg_and_die("can't open %s, %s.zip, %s.ZIP", src_fn, src_fn, src_fn); 430 if (src_fd >= 0) 431 break; 432 if (++i > 2) { 433 *ext = '\0'; 434 bb_error_msg_and_die("can't open %s[.zip]", src_fn); 435 } 436 strcpy(ext, extn[i - 1]); 420 437 } 421 438 xmove_fd(src_fd, zip_fd); … … 583 600 } 584 601 unzip_create_leading_dirs(dst_fn); 585 if (bb_make_directory(dst_fn, dir_mode, 0)) {586 bb_error_msg_and_die("exiting");602 if (bb_make_directory(dst_fn, dir_mode, FILEUTILS_IGNORE_CHMOD_ERR)) { 603 xfunc_die(); 587 604 } 588 605 } else { … … 608 625 } else { 609 626 printf("replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ", dst_fn); 627 fflush_all(); 610 628 if (!fgets(key_buf, sizeof(key_buf), stdin)) { 611 629 bb_perror_msg_and_die("can't read input");
Note:
See TracChangeset
for help on using the changeset viewer.