diff options
author | Ron Yorston <rmy@pobox.com> | 2012-03-22 15:21:20 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-03-22 15:21:20 +0000 |
commit | 0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2 (patch) | |
tree | 6709ddd6071a9c238ba69233540bbcfe560c6a44 /archival | |
parent | 67758035a4fe040c6ac69b39d61bcd6bddd7b827 (diff) | |
parent | 56a3b82e9692a25ef9c9269e88feac0d579ce8e8 (diff) | |
download | busybox-w32-0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2.tar.gz busybox-w32-0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2.tar.bz2 busybox-w32-0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2.zip |
Merge commit '56a3b82e9692a25ef9c9269e88feac0d579ce8e8' into merge
Conflicts:
coreutils/ls.c
include/platform.h
libbb/bb_basename.c
Diffstat (limited to 'archival')
-rw-r--r-- | archival/dpkg.c | 7 | ||||
-rw-r--r-- | archival/libarchive/bz/compress.c | 7 | ||||
-rw-r--r-- | archival/tar.c | 36 |
3 files changed, 33 insertions, 17 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index f8e349d09..8899d1719 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -702,28 +702,21 @@ static unsigned get_status(const unsigned status_node, const int num) | |||
702 | 702 | ||
703 | static void set_status(const unsigned status_node_num, const char *new_value, const int position) | 703 | static void set_status(const unsigned status_node_num, const char *new_value, const int position) |
704 | { | 704 | { |
705 | const unsigned new_value_len = strlen(new_value); | ||
706 | const unsigned new_value_num = search_name_hashtable(new_value); | 705 | const unsigned new_value_num = search_name_hashtable(new_value); |
707 | unsigned want = get_status(status_node_num, 1); | 706 | unsigned want = get_status(status_node_num, 1); |
708 | unsigned flag = get_status(status_node_num, 2); | 707 | unsigned flag = get_status(status_node_num, 2); |
709 | unsigned status = get_status(status_node_num, 3); | 708 | unsigned status = get_status(status_node_num, 3); |
710 | int want_len = strlen(name_hashtable[want]); | ||
711 | int flag_len = strlen(name_hashtable[flag]); | ||
712 | int status_len = strlen(name_hashtable[status]); | ||
713 | char *new_status; | 709 | char *new_status; |
714 | 710 | ||
715 | switch (position) { | 711 | switch (position) { |
716 | case 1: | 712 | case 1: |
717 | want = new_value_num; | 713 | want = new_value_num; |
718 | want_len = new_value_len; | ||
719 | break; | 714 | break; |
720 | case 2: | 715 | case 2: |
721 | flag = new_value_num; | 716 | flag = new_value_num; |
722 | flag_len = new_value_len; | ||
723 | break; | 717 | break; |
724 | case 3: | 718 | case 3: |
725 | status = new_value_num; | 719 | status = new_value_num; |
726 | status_len = new_value_len; | ||
727 | break; | 720 | break; |
728 | default: | 721 | default: |
729 | bb_error_msg_and_die("DEBUG ONLY: this shouldnt happen"); | 722 | bb_error_msg_and_die("DEBUG ONLY: this shouldnt happen"); |
diff --git a/archival/libarchive/bz/compress.c b/archival/libarchive/bz/compress.c index 6f1c70a08..f93671742 100644 --- a/archival/libarchive/bz/compress.c +++ b/archival/libarchive/bz/compress.c | |||
@@ -251,7 +251,7 @@ void sendMTFValues(EState* s) | |||
251 | { | 251 | { |
252 | int32_t v, t, i, j, gs, ge, totc, bt, bc, iter; | 252 | int32_t v, t, i, j, gs, ge, totc, bt, bc, iter; |
253 | int32_t nSelectors, alphaSize, minLen, maxLen, selCtr; | 253 | int32_t nSelectors, alphaSize, minLen, maxLen, selCtr; |
254 | int32_t nGroups, nBytes; | 254 | int32_t nGroups; |
255 | 255 | ||
256 | /* | 256 | /* |
257 | * uint8_t len[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; | 257 | * uint8_t len[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; |
@@ -512,7 +512,6 @@ void sendMTFValues(EState* s) | |||
512 | } | 512 | } |
513 | } | 513 | } |
514 | 514 | ||
515 | nBytes = s->numZ; | ||
516 | bsW(s, 16, inUse16); | 515 | bsW(s, 16, inUse16); |
517 | 516 | ||
518 | inUse16 <<= (sizeof(int)*8 - 16); /* move 15th bit into sign bit */ | 517 | inUse16 <<= (sizeof(int)*8 - 16); /* move 15th bit into sign bit */ |
@@ -528,7 +527,6 @@ void sendMTFValues(EState* s) | |||
528 | } | 527 | } |
529 | 528 | ||
530 | /*--- Now the selectors. ---*/ | 529 | /*--- Now the selectors. ---*/ |
531 | nBytes = s->numZ; | ||
532 | bsW(s, 3, nGroups); | 530 | bsW(s, 3, nGroups); |
533 | bsW(s, 15, nSelectors); | 531 | bsW(s, 15, nSelectors); |
534 | for (i = 0; i < nSelectors; i++) { | 532 | for (i = 0; i < nSelectors; i++) { |
@@ -538,8 +536,6 @@ void sendMTFValues(EState* s) | |||
538 | } | 536 | } |
539 | 537 | ||
540 | /*--- Now the coding tables. ---*/ | 538 | /*--- Now the coding tables. ---*/ |
541 | nBytes = s->numZ; | ||
542 | |||
543 | for (t = 0; t < nGroups; t++) { | 539 | for (t = 0; t < nGroups; t++) { |
544 | int32_t curr = s->len[t][0]; | 540 | int32_t curr = s->len[t][0]; |
545 | bsW(s, 5, curr); | 541 | bsW(s, 5, curr); |
@@ -551,7 +547,6 @@ void sendMTFValues(EState* s) | |||
551 | } | 547 | } |
552 | 548 | ||
553 | /*--- And finally, the block data proper ---*/ | 549 | /*--- And finally, the block data proper ---*/ |
554 | nBytes = s->numZ; | ||
555 | selCtr = 0; | 550 | selCtr = 0; |
556 | gs = 0; | 551 | gs = 0; |
557 | while (1) { | 552 | while (1) { |
diff --git a/archival/tar.c b/archival/tar.c index 52f3c364c..fca2d068b 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -264,7 +264,8 @@ static int writeTarHeader(struct TarBallInfo *tbInfo, | |||
264 | PUT_OCTAL(header.uid, statbuf->st_uid); | 264 | PUT_OCTAL(header.uid, statbuf->st_uid); |
265 | PUT_OCTAL(header.gid, statbuf->st_gid); | 265 | PUT_OCTAL(header.gid, statbuf->st_gid); |
266 | memset(header.size, '0', sizeof(header.size)-1); /* Regular file size is handled later */ | 266 | memset(header.size, '0', sizeof(header.size)-1); /* Regular file size is handled later */ |
267 | 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); | ||
268 | 269 | ||
269 | /* Enter the user and group names */ | 270 | /* Enter the user and group names */ |
270 | safe_strncpy(header.uname, get_cached_username(statbuf->st_uid), sizeof(header.uname)); | 271 | safe_strncpy(header.uname, get_cached_username(statbuf->st_uid), sizeof(header.uname)); |
@@ -316,15 +317,42 @@ static int writeTarHeader(struct TarBallInfo *tbInfo, | |||
316 | } else if (S_ISFIFO(statbuf->st_mode)) { | 317 | } else if (S_ISFIFO(statbuf->st_mode)) { |
317 | header.typeflag = FIFOTYPE; | 318 | header.typeflag = FIFOTYPE; |
318 | } else if (S_ISREG(statbuf->st_mode)) { | 319 | } else if (S_ISREG(statbuf->st_mode)) { |
319 | if (sizeof(statbuf->st_size) > 4 | 320 | /* header.size field is 12 bytes long */ |
320 | && statbuf->st_size > (off_t)0777777777777LL | 321 | /* Does octal-encoded size fit? */ |
322 | uoff_t filesize = statbuf->st_size; | ||
323 | if (sizeof(filesize) <= 4 | ||
324 | || filesize <= (uoff_t)0777777777777LL | ||
321 | ) { | 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 { | ||
322 | bb_error_msg_and_die("can't store file '%s' " | 351 | bb_error_msg_and_die("can't store file '%s' " |
323 | "of size %"OFF_FMT"u, aborting", | 352 | "of size %"OFF_FMT"u, aborting", |
324 | fileName, statbuf->st_size); | 353 | fileName, statbuf->st_size); |
325 | } | 354 | } |
326 | header.typeflag = REGTYPE; | 355 | header.typeflag = REGTYPE; |
327 | PUT_OCTAL(header.size, statbuf->st_size); | ||
328 | } else { | 356 | } else { |
329 | bb_error_msg("%s: unknown file type", fileName); | 357 | bb_error_msg("%s: unknown file type", fileName); |
330 | return FALSE; | 358 | return FALSE; |