aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/cpio.c30
-rw-r--r--archival/dpkg.c6
-rw-r--r--archival/gzip.c16
-rw-r--r--archival/libarchive/decompress_gunzip.c4
-rw-r--r--archival/libarchive/decompress_uncompress.c4
-rw-r--r--archival/libarchive/lzo1x_9x.c12
-rw-r--r--archival/libarchive/lzo1x_c.c2
-rw-r--r--archival/libarchive/lzo1x_d.c2
-rw-r--r--archival/lzop.c10
-rw-r--r--archival/tar.c14
-rw-r--r--archival/unzip.c19
11 files changed, 61 insertions, 58 deletions
diff --git a/archival/cpio.c b/archival/cpio.c
index 98cc18fa0..699c6dbb7 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -253,24 +253,24 @@ static NOINLINE int cpio_o(void)
253 } 253 }
254 254
255 bytes += printf("070701" 255 bytes += printf("070701"
256 "%08X%08X%08X%08X%08X%08X%08X" 256 "%08X%08X%08X%08X%08X%08X%08X"
257 "%08X%08X%08X%08X" /* GNU cpio uses uppercase hex */ 257 "%08X%08X%08X%08X" /* GNU cpio uses uppercase hex */
258 /* strlen+1: */ "%08X" 258 /* strlen+1: */ "%08X"
259 /* chksum: */ "00000000" /* (only for "070702" files) */ 259 /* chksum: */ "00000000" /* (only for "070702" files) */
260 /* name,NUL: */ "%s%c", 260 /* name,NUL: */ "%s%c",
261 (unsigned)(uint32_t) st.st_ino, 261 (unsigned)(uint32_t) st.st_ino,
262 (unsigned)(uint32_t) st.st_mode, 262 (unsigned)(uint32_t) st.st_mode,
263 (unsigned)(uint32_t) st.st_uid, 263 (unsigned)(uint32_t) st.st_uid,
264 (unsigned)(uint32_t) st.st_gid, 264 (unsigned)(uint32_t) st.st_gid,
265 (unsigned)(uint32_t) st.st_nlink, 265 (unsigned)(uint32_t) st.st_nlink,
266 (unsigned)(uint32_t) st.st_mtime, 266 (unsigned)(uint32_t) st.st_mtime,
267 (unsigned)(uint32_t) st.st_size, 267 (unsigned)(uint32_t) st.st_size,
268 (unsigned)(uint32_t) major(st.st_dev), 268 (unsigned)(uint32_t) major(st.st_dev),
269 (unsigned)(uint32_t) minor(st.st_dev), 269 (unsigned)(uint32_t) minor(st.st_dev),
270 (unsigned)(uint32_t) major(st.st_rdev), 270 (unsigned)(uint32_t) major(st.st_rdev),
271 (unsigned)(uint32_t) minor(st.st_rdev), 271 (unsigned)(uint32_t) minor(st.st_rdev),
272 (unsigned)(strlen(name) + 1), 272 (unsigned)(strlen(name) + 1),
273 name, '\0'); 273 name, '\0');
274 bytes = cpio_pad4(bytes); 274 bytes = cpio_pad4(bytes);
275 275
276 if (st.st_size) { 276 if (st.st_size) {
diff --git a/archival/dpkg.c b/archival/dpkg.c
index dae8a9747..ed86f3355 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -1026,8 +1026,8 @@ static int check_deps(deb_file_t **deb_file, int deb_start /*, int dep_max_count
1026 if (package_edge->type == EDGE_CONFLICTS) { 1026 if (package_edge->type == EDGE_CONFLICTS) {
1027 const unsigned package_num = 1027 const unsigned package_num =
1028 search_package_hashtable(package_edge->name, 1028 search_package_hashtable(package_edge->name,
1029 package_edge->version, 1029 package_edge->version,
1030 package_edge->operator); 1030 package_edge->operator);
1031 int result = 0; 1031 int result = 0;
1032 if (package_hashtable[package_num] != NULL) { 1032 if (package_hashtable[package_num] != NULL) {
1033 status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]); 1033 status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
@@ -1114,7 +1114,7 @@ static int check_deps(deb_file_t **deb_file, int deb_start /*, int dep_max_count
1114 */ 1114 */
1115 if (root_of_alternatives && package_edge->type != root_of_alternatives->type - 1) 1115 if (root_of_alternatives && package_edge->type != root_of_alternatives->type - 1)
1116 bb_error_msg_and_die("fatal error, package dependencies corrupt: %d != %d - 1", 1116 bb_error_msg_and_die("fatal error, package dependencies corrupt: %d != %d - 1",
1117 package_edge->type, root_of_alternatives->type); 1117 package_edge->type, root_of_alternatives->type);
1118 1118
1119 if (package_hashtable[package_num] != NULL) 1119 if (package_hashtable[package_num] != NULL)
1120 result = !package_satisfies_dependency(package_num, package_edge->type); 1120 result = !package_satisfies_dependency(package_num, package_edge->type);
diff --git a/archival/gzip.c b/archival/gzip.c
index 80db4f969..31ccab3cd 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -1179,7 +1179,7 @@ static void gen_codes(ct_data * tree, int max_code)
1179 * must be all ones. 1179 * must be all ones.
1180 */ 1180 */
1181 Assert(code + G2.bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1, 1181 Assert(code + G2.bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
1182 "inconsistent bit counts"); 1182 "inconsistent bit counts");
1183 Tracev((stderr, "\ngen_codes: max_code %d ", max_code)); 1183 Tracev((stderr, "\ngen_codes: max_code %d ", max_code));
1184 1184
1185 for (n = 0; n <= max_code; n++) { 1185 for (n = 0; n <= max_code; n++) {
@@ -1527,9 +1527,9 @@ static int ct_tally(int dist, int lc)
1527 } 1527 }
1528 out_length >>= 3; 1528 out_length >>= 3;
1529 Trace((stderr, 1529 Trace((stderr,
1530 "\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) ", 1530 "\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) ",
1531 G2.last_lit, G2.last_dist, in_length, out_length, 1531 G2.last_lit, G2.last_dist, in_length, out_length,
1532 100L - out_length * 100L / in_length)); 1532 100L - out_length * 100L / in_length));
1533 if (G2.last_dist < G2.last_lit / 2 && out_length < in_length / 2) 1533 if (G2.last_dist < G2.last_lit / 2 && out_length < in_length / 2)
1534 return 1; 1534 return 1;
1535 } 1535 }
@@ -1621,9 +1621,9 @@ static ulg flush_block(char *buf, ulg stored_len, int eof)
1621 static_lenb = (G2.static_len + 3 + 7) >> 3; 1621 static_lenb = (G2.static_len + 3 + 7) >> 3;
1622 1622
1623 Trace((stderr, 1623 Trace((stderr,
1624 "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u ", 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, 1625 opt_lenb, G2.opt_len, static_lenb, G2.static_len, stored_len,
1626 G2.last_lit, G2.last_dist)); 1626 G2.last_lit, G2.last_dist));
1627 1627
1628 if (static_lenb <= opt_lenb) 1628 if (static_lenb <= opt_lenb)
1629 opt_lenb = static_lenb; 1629 opt_lenb = static_lenb;
@@ -1661,7 +1661,7 @@ static ulg flush_block(char *buf, ulg stored_len, int eof)
1661 } else { 1661 } else {
1662 send_bits((DYN_TREES << 1) + eof, 3); 1662 send_bits((DYN_TREES << 1) + eof, 3);
1663 send_all_trees(G2.l_desc.max_code + 1, G2.d_desc.max_code + 1, 1663 send_all_trees(G2.l_desc.max_code + 1, G2.d_desc.max_code + 1,
1664 max_blindex + 1); 1664 max_blindex + 1);
1665 compress_block((ct_data *) G2.dyn_ltree, (ct_data *) G2.dyn_dtree); 1665 compress_block((ct_data *) G2.dyn_ltree, (ct_data *) G2.dyn_dtree);
1666 G2.compressed_len += 3 + G2.opt_len; 1666 G2.compressed_len += 3 + G2.opt_len;
1667 } 1667 }
diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c
index 2d5ab3eb3..4e6b138c3 100644
--- a/archival/libarchive/decompress_gunzip.c
+++ b/archival/libarchive/decompress_gunzip.c
@@ -293,8 +293,8 @@ static unsigned fill_bitbuffer(STATE_PARAM unsigned bitbuffer, unsigned *current
293 * m: maximum lookup bits, returns actual 293 * m: maximum lookup bits, returns actual
294 */ 294 */
295static int huft_build(const unsigned *b, const unsigned n, 295static int huft_build(const unsigned *b, const unsigned n,
296 const unsigned s, const unsigned short *d, 296 const unsigned s, const unsigned short *d,
297 const unsigned char *e, huft_t **t, unsigned *m) 297 const unsigned char *e, huft_t **t, unsigned *m)
298{ 298{
299 unsigned a; /* counter for codes of length k */ 299 unsigned a; /* counter for codes of length k */
300 unsigned c[BMAX + 1]; /* bit length count table */ 300 unsigned c[BMAX + 1]; /* bit length count table */
diff --git a/archival/libarchive/decompress_uncompress.c b/archival/libarchive/decompress_uncompress.c
index 3826a65ea..53c27080f 100644
--- a/archival/libarchive/decompress_uncompress.c
+++ b/archival/libarchive/decompress_uncompress.c
@@ -235,8 +235,8 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
235 p = &inbuf[posbits >> 3]; 235 p = &inbuf[posbits >> 3];
236 bb_error_msg 236 bb_error_msg
237 ("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)", 237 ("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)",
238 insize, posbits, p[-1], p[0], p[1], p[2], p[3], 238 insize, posbits, p[-1], p[0], p[1], p[2], p[3],
239 (posbits & 07)); 239 (posbits & 07));
240*/ 240*/
241 bb_error_msg("corrupted data"); 241 bb_error_msg("corrupted data");
242 goto err; 242 goto err;
diff --git a/archival/libarchive/lzo1x_9x.c b/archival/libarchive/lzo1x_9x.c
index 483205155..897132987 100644
--- a/archival/libarchive/lzo1x_9x.c
+++ b/archival/libarchive/lzo1x_9x.c
@@ -644,7 +644,7 @@ static int len_of_coded_match(unsigned m_len, unsigned m_off, unsigned lit)
644 644
645 645
646static int min_gain(unsigned ahead, unsigned lit1, 646static int min_gain(unsigned ahead, unsigned lit1,
647 unsigned lit2, int l1, int l2, int l3) 647 unsigned lit2, int l1, int l2, int l3)
648{ 648{
649 int lazy_match_min_gain = 0; 649 int lazy_match_min_gain = 0;
650 650
@@ -673,7 +673,7 @@ static int min_gain(unsigned ahead, unsigned lit1,
673#if defined(SWD_BEST_OFF) 673#if defined(SWD_BEST_OFF)
674 674
675static void better_match(const lzo_swd_p swd, 675static void better_match(const lzo_swd_p swd,
676 unsigned *m_len, unsigned *m_off) 676 unsigned *m_len, unsigned *m_off)
677{ 677{
678 if (*m_len <= M2_MIN_LEN) 678 if (*m_len <= M2_MIN_LEN)
679 return; 679 return;
@@ -914,8 +914,8 @@ int lzo1x_999_compress_level(const uint8_t *in, unsigned in_len,
914 914
915 compression_level -= 7; 915 compression_level -= 7;
916 return lzo1x_999_compress_internal(in, in_len, out, out_len, wrkmem, 916 return lzo1x_999_compress_internal(in, in_len, out, out_len, wrkmem,
917 c[compression_level].good_length, 917 c[compression_level].good_length,
918 c[compression_level].max_lazy, 918 c[compression_level].max_lazy,
919 c[compression_level].max_chain, 919 c[compression_level].max_chain,
920 c[compression_level].use_best_off); 920 c[compression_level].use_best_off);
921} 921}
diff --git a/archival/libarchive/lzo1x_c.c b/archival/libarchive/lzo1x_c.c
index cc86f74b1..8c77072ab 100644
--- a/archival/libarchive/lzo1x_c.c
+++ b/archival/libarchive/lzo1x_c.c
@@ -15,7 +15,7 @@
15 15
16 The LZO library is distributed in the hope that it will be useful, 16 The LZO library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details. 19 GNU General Public License for more details.
20 20
21 You should have received a copy of the GNU General Public License 21 You should have received a copy of the GNU General Public License
diff --git a/archival/libarchive/lzo1x_d.c b/archival/libarchive/lzo1x_d.c
index 348a85510..9bc1270da 100644
--- a/archival/libarchive/lzo1x_d.c
+++ b/archival/libarchive/lzo1x_d.c
@@ -15,7 +15,7 @@
15 15
16 The LZO library is distributed in the hope that it will be useful, 16 The LZO library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details. 19 GNU General Public License for more details.
20 20
21 You should have received a copy of the GNU General Public License 21 You should have received a copy of the GNU General Public License
diff --git a/archival/lzop.c b/archival/lzop.c
index fbe08417d..56003d421 100644
--- a/archival/lzop.c
+++ b/archival/lzop.c
@@ -14,7 +14,7 @@
14 14
15 This program is distributed in the hope that it will be useful, 15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details. 18 GNU General Public License for more details.
19 19
20 You should have received a copy of the GNU General Public License 20 You should have received a copy of the GNU General Public License
@@ -116,7 +116,7 @@ static NOINLINE int lzo1x_optimize(uint8_t *in, unsigned in_len,
116 unsigned nl; 116 unsigned nl;
117 unsigned long o_m1_a = 0, o_m1_b = 0, o_m2 = 0, o_m3_a = 0, o_m3_b = 0; 117 unsigned long o_m1_a = 0, o_m1_b = 0, o_m2 = 0, o_m3_a = 0, o_m3_b = 0;
118 118
119// LZO_UNUSED(wrkmem); 119// LZO_UNUSED(wrkmem);
120 120
121 *out_len = 0; 121 *out_len = 0;
122 122
@@ -346,11 +346,11 @@ static NOINLINE int lzo1x_optimize(uint8_t *in, unsigned in_len,
346 return LZO_E_EOF_NOT_FOUND; 346 return LZO_E_EOF_NOT_FOUND;
347 347
348 eof_found: 348 eof_found:
349// LZO_UNUSED(o_m1_a); LZO_UNUSED(o_m1_b); LZO_UNUSED(o_m2); 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); 350// LZO_UNUSED(o_m3_a); LZO_UNUSED(o_m3_b);
351 *out_len = pd(op, out); 351 *out_len = pd(op, out);
352 return (ip == ip_end ? LZO_E_OK : 352 return (ip == ip_end ? LZO_E_OK :
353 (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));
354} 354}
355 355
356/**********************************************************************/ 356/**********************************************************************/
diff --git a/archival/tar.c b/archival/tar.c
index e27950b6c..648d1256d 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -333,13 +333,13 @@ static int writeTarHeader(struct TarBallInfo *tbInfo,
333 && (filesize <= 0x3fffffffffffffffffffffffLL) 333 && (filesize <= 0x3fffffffffffffffffffffffLL)
334#endif 334#endif
335 ) { 335 ) {
336 /* GNU tar uses "base-256 encoding" for very large numbers. 336 /* GNU tar uses "base-256 encoding" for very large numbers.
337 * Encoding is binary, with highest bit always set as a marker 337 * Encoding is binary, with highest bit always set as a marker
338 * and sign in next-highest bit: 338 * and sign in next-highest bit:
339 * 80 00 .. 00 - zero 339 * 80 00 .. 00 - zero
340 * bf ff .. ff - largest positive number 340 * bf ff .. ff - largest positive number
341 * ff ff .. ff - minus 1 341 * ff ff .. ff - minus 1
342 * c0 00 .. 00 - smallest negative number 342 * c0 00 .. 00 - smallest negative number
343 */ 343 */
344 char *p8 = header.size + sizeof(header.size); 344 char *p8 = header.size + sizeof(header.size);
345 do { 345 do {
diff --git a/archival/unzip.c b/archival/unzip.c
index 046027cc6..e4c824850 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -267,6 +267,14 @@ static void unzip_extract(zip_header_t *zip_header, int dst_fd)
267 } 267 }
268} 268}
269 269
270static void my_fgets80(char *buf80)
271{
272 fflush_all();
273 if (!fgets(buf80, 80, stdin)) {
274 bb_perror_msg_and_die("can't read standard input");
275 }
276}
277
270int unzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 278int unzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
271int unzip_main(int argc, char **argv) 279int unzip_main(int argc, char **argv)
272{ 280{
@@ -291,7 +299,7 @@ int unzip_main(int argc, char **argv)
291 llist_t *zreject = NULL; 299 llist_t *zreject = NULL;
292 char *base_dir = NULL; 300 char *base_dir = NULL;
293 int i, opt; 301 int i, opt;
294 char key_buf[80]; 302 char key_buf[80]; /* must match size used by my_fgets80 */
295 struct stat stat_buf; 303 struct stat stat_buf;
296 304
297/* -q, -l and -v: UnZip 5.52 of 28 February 2005, by Info-ZIP: 305/* -q, -l and -v: UnZip 5.52 of 28 February 2005, by Info-ZIP:
@@ -624,10 +632,7 @@ int unzip_main(int argc, char **argv)
624 i = 'y'; 632 i = 'y';
625 } else { 633 } else {
626 printf("replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ", dst_fn); 634 printf("replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ", dst_fn);
627 fflush_all(); 635 my_fgets80(key_buf);
628 if (!fgets(key_buf, sizeof(key_buf), stdin)) {
629 bb_perror_msg_and_die("can't read input");
630 }
631 i = key_buf[0]; 636 i = key_buf[0];
632 } 637 }
633 } else { /* File is not regular file */ 638 } else { /* File is not regular file */
@@ -668,9 +673,7 @@ int unzip_main(int argc, char **argv)
668 case 'r': 673 case 'r':
669 /* Prompt for new name */ 674 /* Prompt for new name */
670 printf("new name: "); 675 printf("new name: ");
671 if (!fgets(key_buf, sizeof(key_buf), stdin)) { 676 my_fgets80(key_buf);
672 bb_perror_msg_and_die("can't read input");
673 }
674 free(dst_fn); 677 free(dst_fn);
675 dst_fn = xstrdup(key_buf); 678 dst_fn = xstrdup(key_buf);
676 chomp(dst_fn); 679 chomp(dst_fn);