diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
commit | cad5364599eb5062d59e0c397ed638ddd61a8d5d (patch) | |
tree | a318d0f03aa076c74b576ea45dc543a5669e8e91 /archival/libunarchive | |
parent | e01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff) | |
download | busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2 busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip |
Major coreutils update.
Diffstat (limited to 'archival/libunarchive')
-rw-r--r-- | archival/libunarchive/archive_copy_file.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/archive_xread.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/archive_xread_all.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/archive_xread_all_eof.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/check_header_gzip.c | 16 | ||||
-rw-r--r-- | archival/libunarchive/data_extract_all.c | 16 | ||||
-rw-r--r-- | archival/libunarchive/decompress_bunzip2.c | 8 | ||||
-rw-r--r-- | archival/libunarchive/decompress_uncompress.c | 8 | ||||
-rw-r--r-- | archival/libunarchive/decompress_unzip.c | 32 | ||||
-rw-r--r-- | archival/libunarchive/get_header_ar.c | 16 | ||||
-rw-r--r-- | archival/libunarchive/get_header_cpio.c | 16 | ||||
-rw-r--r-- | archival/libunarchive/get_header_tar.c | 10 | ||||
-rw-r--r-- | archival/libunarchive/get_header_tar_gz.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/header_verbose_list.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/seek_by_jump.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/uncompress.c | 8 | ||||
-rw-r--r-- | archival/libunarchive/unpack_ar_archive.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/unzip.c | 32 |
18 files changed, 89 insertions, 89 deletions
diff --git a/archival/libunarchive/archive_copy_file.c b/archival/libunarchive/archive_copy_file.c index faa8059ef..675bc6ffe 100644 --- a/archival/libunarchive/archive_copy_file.c +++ b/archival/libunarchive/archive_copy_file.c | |||
@@ -35,7 +35,7 @@ extern void archive_copy_file(const archive_handle_t *archive_handle, const int | |||
35 | size = archive_xread(archive_handle, buffer, size); | 35 | size = archive_xread(archive_handle, buffer, size); |
36 | 36 | ||
37 | if (write(dst_fd, buffer, size) != size) { | 37 | if (write(dst_fd, buffer, size) != size) { |
38 | error_msg_and_die ("Short write"); | 38 | bb_error_msg_and_die ("Short write"); |
39 | } | 39 | } |
40 | chunksize -= size; | 40 | chunksize -= size; |
41 | } | 41 | } |
diff --git a/archival/libunarchive/archive_xread.c b/archival/libunarchive/archive_xread.c index 7fde4c0b1..0b29dbfb9 100644 --- a/archival/libunarchive/archive_xread.c +++ b/archival/libunarchive/archive_xread.c | |||
@@ -26,7 +26,7 @@ extern ssize_t archive_xread(const archive_handle_t *archive_handle, unsigned ch | |||
26 | 26 | ||
27 | size = archive_handle->read(archive_handle->src_fd, buf, count); | 27 | size = archive_handle->read(archive_handle->src_fd, buf, count); |
28 | if (size == -1) { | 28 | if (size == -1) { |
29 | perror_msg_and_die("Read error"); | 29 | bb_perror_msg_and_die("Read error"); |
30 | } | 30 | } |
31 | 31 | ||
32 | return(size); | 32 | return(size); |
diff --git a/archival/libunarchive/archive_xread_all.c b/archival/libunarchive/archive_xread_all.c index ef8cc0141..cfe046b27 100644 --- a/archival/libunarchive/archive_xread_all.c +++ b/archival/libunarchive/archive_xread_all.c | |||
@@ -26,7 +26,7 @@ extern void archive_xread_all(const archive_handle_t *archive_handle, void *buf, | |||
26 | 26 | ||
27 | size = archive_xread(archive_handle, buf, count); | 27 | size = archive_xread(archive_handle, buf, count); |
28 | if (size != count) { | 28 | if (size != count) { |
29 | error_msg_and_die("Short read"); | 29 | bb_error_msg_and_die("Short read"); |
30 | } | 30 | } |
31 | return; | 31 | return; |
32 | } | 32 | } |
diff --git a/archival/libunarchive/archive_xread_all_eof.c b/archival/libunarchive/archive_xread_all_eof.c index 3cfbbd8d1..23719cd7b 100644 --- a/archival/libunarchive/archive_xread_all_eof.c +++ b/archival/libunarchive/archive_xread_all_eof.c | |||
@@ -26,7 +26,7 @@ extern ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned | |||
26 | 26 | ||
27 | size = archive_xread(archive_handle, buf, count); | 27 | size = archive_xread(archive_handle, buf, count); |
28 | if ((size != 0) && (size != count)) { | 28 | if ((size != 0) && (size != count)) { |
29 | perror_msg_and_die("Short read, read %d of %d", size, count); | 29 | bb_perror_msg_and_die("Short read, read %d of %d", size, count); |
30 | } | 30 | } |
31 | return(size); | 31 | return(size); |
32 | } | 32 | } |
diff --git a/archival/libunarchive/check_header_gzip.c b/archival/libunarchive/check_header_gzip.c index d661df7cc..13832c240 100644 --- a/archival/libunarchive/check_header_gzip.c +++ b/archival/libunarchive/check_header_gzip.c | |||
@@ -15,11 +15,11 @@ extern void check_header_gzip(int src_fd) | |||
15 | } formated; | 15 | } formated; |
16 | } header; | 16 | } header; |
17 | 17 | ||
18 | xread_all(src_fd, header.raw, 8); | 18 | bb_xread_all(src_fd, header.raw, 8); |
19 | 19 | ||
20 | /* Check the compression method */ | 20 | /* Check the compression method */ |
21 | if (header.formated.method != 8) { | 21 | if (header.formated.method != 8) { |
22 | error_msg_and_die("Unknown compression method %d", | 22 | bb_error_msg_and_die("Unknown compression method %d", |
23 | header.formated.method); | 23 | header.formated.method); |
24 | } | 24 | } |
25 | 25 | ||
@@ -27,10 +27,10 @@ extern void check_header_gzip(int src_fd) | |||
27 | /* bit 2 set: extra field present */ | 27 | /* bit 2 set: extra field present */ |
28 | unsigned char extra_short; | 28 | unsigned char extra_short; |
29 | 29 | ||
30 | extra_short = xread_char(src_fd) + (xread_char(src_fd) << 8); | 30 | extra_short = bb_xread_char(src_fd) + (bb_xread_char(src_fd) << 8); |
31 | while (extra_short > 0) { | 31 | while (extra_short > 0) { |
32 | /* Ignore extra field */ | 32 | /* Ignore extra field */ |
33 | xread_char(src_fd); | 33 | bb_xread_char(src_fd); |
34 | extra_short--; | 34 | extra_short--; |
35 | } | 35 | } |
36 | } | 36 | } |
@@ -38,19 +38,19 @@ extern void check_header_gzip(int src_fd) | |||
38 | /* Discard original name if any */ | 38 | /* Discard original name if any */ |
39 | if (header.formated.flags & 0x08) { | 39 | if (header.formated.flags & 0x08) { |
40 | /* bit 3 set: original file name present */ | 40 | /* bit 3 set: original file name present */ |
41 | while(xread_char(src_fd) != 0); | 41 | while(bb_xread_char(src_fd) != 0); |
42 | } | 42 | } |
43 | 43 | ||
44 | /* Discard file comment if any */ | 44 | /* Discard file comment if any */ |
45 | if (header.formated.flags & 0x10) { | 45 | if (header.formated.flags & 0x10) { |
46 | /* bit 4 set: file comment present */ | 46 | /* bit 4 set: file comment present */ |
47 | while(xread_char(src_fd) != 0); | 47 | while(bb_xread_char(src_fd) != 0); |
48 | } | 48 | } |
49 | 49 | ||
50 | /* Read the header checksum */ | 50 | /* Read the header checksum */ |
51 | if (header.formated.flags & 0x02) { | 51 | if (header.formated.flags & 0x02) { |
52 | xread_char(src_fd); | 52 | bb_xread_char(src_fd); |
53 | xread_char(src_fd); | 53 | bb_xread_char(src_fd); |
54 | } | 54 | } |
55 | 55 | ||
56 | return; | 56 | return; |
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c index 1eb8bb388..77b4de593 100644 --- a/archival/libunarchive/data_extract_all.c +++ b/archival/libunarchive/data_extract_all.c | |||
@@ -34,8 +34,8 @@ extern void data_extract_all(archive_handle_t *archive_handle) | |||
34 | int res; | 34 | int res; |
35 | 35 | ||
36 | if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) { | 36 | if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) { |
37 | char *name = xstrdup(file_header->name); | 37 | char *name = bb_xstrdup(file_header->name); |
38 | make_directory (dirname(name), 0777, FILEUTILS_RECUR); | 38 | bb_make_directory (dirname(name), 0777, FILEUTILS_RECUR); |
39 | free(name); | 39 | free(name); |
40 | } | 40 | } |
41 | 41 | ||
@@ -47,13 +47,13 @@ extern void data_extract_all(archive_handle_t *archive_handle) | |||
47 | /* hard link */ | 47 | /* hard link */ |
48 | res = link(file_header->link_name, file_header->name); | 48 | res = link(file_header->link_name, file_header->name); |
49 | if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) { | 49 | if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) { |
50 | perror_msg("Couldnt create hard link"); | 50 | bb_perror_msg("Couldnt create hard link"); |
51 | } | 51 | } |
52 | } else | 52 | } else |
53 | #endif | 53 | #endif |
54 | { | 54 | { |
55 | /* Regular file */ | 55 | /* Regular file */ |
56 | dst_fd = xopen(file_header->name, O_WRONLY | O_CREAT); | 56 | dst_fd = bb_xopen(file_header->name, O_WRONLY | O_CREAT); |
57 | archive_copy_file(archive_handle, dst_fd); | 57 | archive_copy_file(archive_handle, dst_fd); |
58 | close(dst_fd); | 58 | close(dst_fd); |
59 | } | 59 | } |
@@ -63,7 +63,7 @@ extern void data_extract_all(archive_handle_t *archive_handle) | |||
63 | unlink(file_header->name); | 63 | unlink(file_header->name); |
64 | res = mkdir(file_header->name, file_header->mode); | 64 | res = mkdir(file_header->name, file_header->mode); |
65 | if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) { | 65 | if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) { |
66 | perror_msg("extract_archive: %s", file_header->name); | 66 | bb_perror_msg("extract_archive: %s", file_header->name); |
67 | } | 67 | } |
68 | break; | 68 | break; |
69 | case S_IFLNK: | 69 | case S_IFLNK: |
@@ -71,7 +71,7 @@ extern void data_extract_all(archive_handle_t *archive_handle) | |||
71 | unlink(file_header->name); | 71 | unlink(file_header->name); |
72 | res = symlink(file_header->link_name, file_header->name); | 72 | res = symlink(file_header->link_name, file_header->name); |
73 | if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) { | 73 | if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) { |
74 | perror_msg("Cannot create symlink from %s to '%s'", file_header->name, file_header->link_name); | 74 | bb_perror_msg("Cannot create symlink from %s to '%s'", file_header->name, file_header->link_name); |
75 | } | 75 | } |
76 | break; | 76 | break; |
77 | case S_IFSOCK: | 77 | case S_IFSOCK: |
@@ -81,11 +81,11 @@ extern void data_extract_all(archive_handle_t *archive_handle) | |||
81 | unlink(file_header->name); | 81 | unlink(file_header->name); |
82 | res = mknod(file_header->name, file_header->mode, file_header->device); | 82 | res = mknod(file_header->name, file_header->mode, file_header->device); |
83 | if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) { | 83 | if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) { |
84 | perror_msg("Cannot create node %s", file_header->name); | 84 | bb_perror_msg("Cannot create node %s", file_header->name); |
85 | } | 85 | } |
86 | break; | 86 | break; |
87 | default: | 87 | default: |
88 | error_msg_and_die("Unrecognised file type"); | 88 | bb_error_msg_and_die("Unrecognised file type"); |
89 | } | 89 | } |
90 | 90 | ||
91 | chmod(file_header->name, file_header->mode); | 91 | chmod(file_header->name, file_header->mode); |
diff --git a/archival/libunarchive/decompress_bunzip2.c b/archival/libunarchive/decompress_bunzip2.c index 4b611b833..0164b77e0 100644 --- a/archival/libunarchive/decompress_bunzip2.c +++ b/archival/libunarchive/decompress_bunzip2.c | |||
@@ -1548,7 +1548,7 @@ extern ssize_t read_bz2(int fd, void *buf, size_t count) | |||
1548 | 1548 | ||
1549 | while (1) { | 1549 | while (1) { |
1550 | if (bzf->strm.avail_in == 0) { | 1550 | if (bzf->strm.avail_in == 0) { |
1551 | n = xread(bzf->fd, bzf->buf, BZ_MAX_UNUSED); | 1551 | n = bb_xread(bzf->fd, bzf->buf, BZ_MAX_UNUSED); |
1552 | if (n == 0) { | 1552 | if (n == 0) { |
1553 | break; | 1553 | break; |
1554 | } | 1554 | } |
@@ -1560,7 +1560,7 @@ extern ssize_t read_bz2(int fd, void *buf, size_t count) | |||
1560 | ret = BZ2_bzDecompress(&(bzf->strm)); | 1560 | ret = BZ2_bzDecompress(&(bzf->strm)); |
1561 | 1561 | ||
1562 | if ((ret != BZ_OK) && (ret != BZ_STREAM_END)) { | 1562 | if ((ret != BZ_OK) && (ret != BZ_STREAM_END)) { |
1563 | error_msg_and_die("Error decompressing"); | 1563 | bb_error_msg_and_die("Error decompressing"); |
1564 | } | 1564 | } |
1565 | 1565 | ||
1566 | if (ret == BZ_STREAM_END) { | 1566 | if (ret == BZ_STREAM_END) { |
@@ -1628,12 +1628,12 @@ extern unsigned char uncompressStream(int src_fd, int dst_fd) | |||
1628 | while (bzerr == BZ_OK) { | 1628 | while (bzerr == BZ_OK) { |
1629 | nread = read_bz2(src_fd, obuf, 5000); | 1629 | nread = read_bz2(src_fd, obuf, 5000); |
1630 | if (bzerr == BZ_DATA_ERROR_MAGIC) { | 1630 | if (bzerr == BZ_DATA_ERROR_MAGIC) { |
1631 | error_msg_and_die("invalid magic"); | 1631 | bb_error_msg_and_die("invalid magic"); |
1632 | } | 1632 | } |
1633 | if (((bzerr == BZ_OK) || (bzerr == BZ_STREAM_END)) && (nread > 0)) { | 1633 | if (((bzerr == BZ_OK) || (bzerr == BZ_STREAM_END)) && (nread > 0)) { |
1634 | if (write(dst_fd, obuf, nread) != nread) { | 1634 | if (write(dst_fd, obuf, nread) != nread) { |
1635 | BZ2_bzReadClose(); | 1635 | BZ2_bzReadClose(); |
1636 | perror_msg_and_die("Couldnt write to file"); | 1636 | bb_perror_msg_and_die("Couldnt write to file"); |
1637 | } | 1637 | } |
1638 | } | 1638 | } |
1639 | } | 1639 | } |
diff --git a/archival/libunarchive/decompress_uncompress.c b/archival/libunarchive/decompress_uncompress.c index 192e98126..9851ca39d 100644 --- a/archival/libunarchive/decompress_uncompress.c +++ b/archival/libunarchive/decompress_uncompress.c | |||
@@ -121,14 +121,14 @@ extern int uncompress(int fd_in, int fd_out) | |||
121 | 121 | ||
122 | insize = 0; | 122 | insize = 0; |
123 | 123 | ||
124 | inbuf[0] = xread_char(fd_in); | 124 | inbuf[0] = bb_xread_char(fd_in); |
125 | 125 | ||
126 | maxbits = inbuf[0] & BIT_MASK; | 126 | maxbits = inbuf[0] & BIT_MASK; |
127 | block_mode = inbuf[0] & BLOCK_MODE; | 127 | block_mode = inbuf[0] & BLOCK_MODE; |
128 | maxmaxcode = MAXCODE(maxbits); | 128 | maxmaxcode = MAXCODE(maxbits); |
129 | 129 | ||
130 | if (maxbits > BITS) { | 130 | if (maxbits > BITS) { |
131 | error_msg("compressed with %d bits, can only handle %d bits", maxbits, | 131 | bb_error_msg("compressed with %d bits, can only handle %d bits", maxbits, |
132 | BITS); | 132 | BITS); |
133 | return -1; | 133 | return -1; |
134 | } | 134 | } |
@@ -227,11 +227,11 @@ extern int uncompress(int fd_in, int fd_out) | |||
227 | posbits -= n_bits; | 227 | posbits -= n_bits; |
228 | p = &inbuf[posbits >> 3]; | 228 | p = &inbuf[posbits >> 3]; |
229 | 229 | ||
230 | error_msg | 230 | bb_error_msg |
231 | ("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)", | 231 | ("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)", |
232 | insize, posbits, p[-1], p[0], p[1], p[2], p[3], | 232 | insize, posbits, p[-1], p[0], p[1], p[2], p[3], |
233 | (posbits & 07)); | 233 | (posbits & 07)); |
234 | error_msg("uncompress: corrupt input"); | 234 | bb_error_msg("uncompress: corrupt input"); |
235 | return -1; | 235 | return -1; |
236 | } | 236 | } |
237 | 237 | ||
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index 3a7334ce9..2401cf831 100644 --- a/archival/libunarchive/decompress_unzip.c +++ b/archival/libunarchive/decompress_unzip.c | |||
@@ -150,7 +150,7 @@ static void fill_bytebuffer(void) | |||
150 | /* Leave the first 4 bytes empty so we can always unwind the bitbuffer | 150 | /* Leave the first 4 bytes empty so we can always unwind the bitbuffer |
151 | * to the front of the bytebuffer, leave 4 bytes free at end of tail | 151 | * to the front of the bytebuffer, leave 4 bytes free at end of tail |
152 | * so we can easily top up buffer in check_trailer_gzip() */ | 152 | * so we can easily top up buffer in check_trailer_gzip() */ |
153 | bytebuffer_size = 4 + xread(gunzip_src_fd, &bytebuffer[4], BYTEBUFFER_MAX - 8); | 153 | bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], BYTEBUFFER_MAX - 8); |
154 | bytebuffer_offset = 4; | 154 | bytebuffer_offset = 4; |
155 | } | 155 | } |
156 | } | 156 | } |
@@ -448,7 +448,7 @@ static int inflate_codes(huft_t * my_tl, huft_t * my_td, const unsigned int my_b | |||
448 | if ((e = (t = tl + ((unsigned) b & ml))->e) > 16) | 448 | if ((e = (t = tl + ((unsigned) b & ml))->e) > 16) |
449 | do { | 449 | do { |
450 | if (e == 99) { | 450 | if (e == 99) { |
451 | error_msg_and_die("inflate_codes error 1");; | 451 | bb_error_msg_and_die("inflate_codes error 1");; |
452 | } | 452 | } |
453 | b >>= t->b; | 453 | b >>= t->b; |
454 | k -= t->b; | 454 | k -= t->b; |
@@ -484,7 +484,7 @@ static int inflate_codes(huft_t * my_tl, huft_t * my_td, const unsigned int my_b | |||
484 | if ((e = (t = td + ((unsigned) b & md))->e) > 16) | 484 | if ((e = (t = td + ((unsigned) b & md))->e) > 16) |
485 | do { | 485 | do { |
486 | if (e == 99) | 486 | if (e == 99) |
487 | error_msg_and_die("inflate_codes error 2");; | 487 | bb_error_msg_and_die("inflate_codes error 2");; |
488 | b >>= t->b; | 488 | b >>= t->b; |
489 | k -= t->b; | 489 | k -= t->b; |
490 | e -= 16; | 490 | e -= 16; |
@@ -821,7 +821,7 @@ static int inflate_block(int *e) | |||
821 | 821 | ||
822 | if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) { | 822 | if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) { |
823 | if (i == 1) { | 823 | if (i == 1) { |
824 | error_msg_and_die("Incomplete literal tree"); | 824 | bb_error_msg_and_die("Incomplete literal tree"); |
825 | huft_free(tl); | 825 | huft_free(tl); |
826 | } | 826 | } |
827 | return i; /* incomplete code set */ | 827 | return i; /* incomplete code set */ |
@@ -830,7 +830,7 @@ static int inflate_block(int *e) | |||
830 | bd = dbits; | 830 | bd = dbits; |
831 | if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) { | 831 | if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) { |
832 | if (i == 1) { | 832 | if (i == 1) { |
833 | error_msg_and_die("incomplete distance tree"); | 833 | bb_error_msg_and_die("incomplete distance tree"); |
834 | huft_free(td); | 834 | huft_free(td); |
835 | } | 835 | } |
836 | huft_free(tl); | 836 | huft_free(tl); |
@@ -846,7 +846,7 @@ static int inflate_block(int *e) | |||
846 | } | 846 | } |
847 | default: | 847 | default: |
848 | /* bad block type */ | 848 | /* bad block type */ |
849 | error_msg_and_die("bad block type %d\n", t); | 849 | bb_error_msg_and_die("bad block type %d\n", t); |
850 | } | 850 | } |
851 | } | 851 | } |
852 | 852 | ||
@@ -884,7 +884,7 @@ static int inflate_get_next_window(void) | |||
884 | break; | 884 | break; |
885 | case -2: ret = inflate_codes(0,0,0,0,0); | 885 | case -2: ret = inflate_codes(0,0,0,0,0); |
886 | break; | 886 | break; |
887 | default: error_msg_and_die("inflate error %d", method); | 887 | default: bb_error_msg_and_die("inflate error %d", method); |
888 | } | 888 | } |
889 | 889 | ||
890 | if (ret == 1) { | 890 | if (ret == 1) { |
@@ -975,16 +975,16 @@ extern void GZ_gzReadClose(void) | |||
975 | ssize_t nread, nwrote; | 975 | ssize_t nread, nwrote; |
976 | 976 | ||
977 | GZ_gzReadOpen(in, 0, 0); | 977 | GZ_gzReadOpen(in, 0, 0); |
978 | while(1) { // Robbed from copyfd.c | 978 | while(1) { // Robbed from bb_copyfd.c |
979 | nread = read_gz(in, buf, sizeof(buf)); | 979 | nread = read_gz(in, buf, sizeof(buf)); |
980 | if (nread == 0) break; // no data to write | 980 | if (nread == 0) break; // no data to write |
981 | else if (nread == -1) { | 981 | else if (nread == -1) { |
982 | perror_msg("read"); | 982 | bb_perror_msg("read"); |
983 | return -1; | 983 | return -1; |
984 | } | 984 | } |
985 | nwrote = full_write(out, buf, nread); | 985 | nwrote = bb_full_write(out, buf, nread); |
986 | if (nwrote == -1) { | 986 | if (nwrote == -1) { |
987 | perror_msg("write"); | 987 | bb_perror_msg("write"); |
988 | return -1; | 988 | return -1; |
989 | } | 989 | } |
990 | } | 990 | } |
@@ -998,9 +998,9 @@ extern int inflate(int in, int out) | |||
998 | GZ_gzReadOpen(in, 0, 0); | 998 | GZ_gzReadOpen(in, 0, 0); |
999 | while(1) { | 999 | while(1) { |
1000 | int ret = inflate_get_next_window(); | 1000 | int ret = inflate_get_next_window(); |
1001 | nwrote = full_write(out, gunzip_window, gunzip_outbuf_count); | 1001 | nwrote = bb_full_write(out, gunzip_window, gunzip_outbuf_count); |
1002 | if (nwrote == -1) { | 1002 | if (nwrote == -1) { |
1003 | perror_msg("write"); | 1003 | bb_perror_msg("write"); |
1004 | return -1; | 1004 | return -1; |
1005 | } | 1005 | } |
1006 | if (ret == 0) break; | 1006 | if (ret == 0) break; |
@@ -1017,7 +1017,7 @@ extern void check_trailer_gzip(int src_fd) | |||
1017 | /* top up the input buffer with the rest of the trailer */ | 1017 | /* top up the input buffer with the rest of the trailer */ |
1018 | count = bytebuffer_size - bytebuffer_offset; | 1018 | count = bytebuffer_size - bytebuffer_offset; |
1019 | if (count < 8) { | 1019 | if (count < 8) { |
1020 | xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count); | 1020 | bb_xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count); |
1021 | bytebuffer_size += 8 - count; | 1021 | bytebuffer_size += 8 - count; |
1022 | } | 1022 | } |
1023 | for (count = 0; count != 4; count++) { | 1023 | for (count = 0; count != 4; count++) { |
@@ -1027,14 +1027,14 @@ extern void check_trailer_gzip(int src_fd) | |||
1027 | 1027 | ||
1028 | /* Validate decompression - crc */ | 1028 | /* Validate decompression - crc */ |
1029 | if (stored_crc != (gunzip_crc ^ 0xffffffffL)) { | 1029 | if (stored_crc != (gunzip_crc ^ 0xffffffffL)) { |
1030 | error_msg_and_die("crc error"); | 1030 | bb_error_msg_and_die("crc error"); |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | /* Validate decompression - size */ | 1033 | /* Validate decompression - size */ |
1034 | if (gunzip_bytes_out != | 1034 | if (gunzip_bytes_out != |
1035 | (bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) | | 1035 | (bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) | |
1036 | (bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) { | 1036 | (bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) { |
1037 | error_msg_and_die("Incorrect length, but crc is correct"); | 1037 | bb_error_msg_and_die("Incorrect length, but crc is correct"); |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | } | 1040 | } |
diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c index 1e0e6c12d..6c576a8da 100644 --- a/archival/libunarchive/get_header_ar.c +++ b/archival/libunarchive/get_header_ar.c | |||
@@ -41,7 +41,7 @@ extern char get_header_ar(archive_handle_t *archive_handle) | |||
41 | static unsigned int ar_long_name_size; | 41 | static unsigned int ar_long_name_size; |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | /* dont use xread as we want to handle the error ourself */ | 44 | /* dont use bb_xread as we want to handle the error ourself */ |
45 | if (read(archive_handle->src_fd, ar.raw, 60) != 60) { | 45 | if (read(archive_handle->src_fd, ar.raw, 60) != 60) { |
46 | /* End Of File */ | 46 | /* End Of File */ |
47 | return(EXIT_FAILURE); | 47 | return(EXIT_FAILURE); |
@@ -51,14 +51,14 @@ extern char get_header_ar(archive_handle_t *archive_handle) | |||
51 | if (ar.raw[0] == '\n') { | 51 | if (ar.raw[0] == '\n') { |
52 | /* fix up the header, we started reading 1 byte too early */ | 52 | /* fix up the header, we started reading 1 byte too early */ |
53 | memmove(ar.raw, &ar.raw[1], 59); | 53 | memmove(ar.raw, &ar.raw[1], 59); |
54 | ar.raw[59] = xread_char(archive_handle->src_fd); | 54 | ar.raw[59] = bb_xread_char(archive_handle->src_fd); |
55 | archive_handle->offset++; | 55 | archive_handle->offset++; |
56 | } | 56 | } |
57 | archive_handle->offset += 60; | 57 | archive_handle->offset += 60; |
58 | 58 | ||
59 | /* align the headers based on the header magic */ | 59 | /* align the headers based on the header magic */ |
60 | if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) { | 60 | if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) { |
61 | error_msg_and_die("Invalid ar header"); | 61 | bb_error_msg_and_die("Invalid ar header"); |
62 | } | 62 | } |
63 | 63 | ||
64 | typed->mode = strtol(ar.formated.mode, NULL, 8); | 64 | typed->mode = strtol(ar.formated.mode, NULL, 8); |
@@ -76,7 +76,7 @@ extern char get_header_ar(archive_handle_t *archive_handle) | |||
76 | * in static variable long_names for use in future entries */ | 76 | * in static variable long_names for use in future entries */ |
77 | ar_long_name_size = typed->size; | 77 | ar_long_name_size = typed->size; |
78 | ar_long_names = xmalloc(ar_long_name_size); | 78 | ar_long_names = xmalloc(ar_long_name_size); |
79 | xread_all(archive_handle->src_fd, ar_long_names, ar_long_name_size); | 79 | bb_xread_all(archive_handle->src_fd, ar_long_names, ar_long_name_size); |
80 | archive_handle->offset += ar_long_name_size; | 80 | archive_handle->offset += ar_long_name_size; |
81 | /* This ar entries data section only contained filenames for other records | 81 | /* This ar entries data section only contained filenames for other records |
82 | * they are stored in the static ar_long_names for future reference */ | 82 | * they are stored in the static ar_long_names for future reference */ |
@@ -90,16 +90,16 @@ extern char get_header_ar(archive_handle_t *archive_handle) | |||
90 | (saved in variable long_name) that conatains the real filename */ | 90 | (saved in variable long_name) that conatains the real filename */ |
91 | const unsigned int long_offset = atoi(&ar.formated.name[1]); | 91 | const unsigned int long_offset = atoi(&ar.formated.name[1]); |
92 | if (long_offset >= ar_long_name_size) { | 92 | if (long_offset >= ar_long_name_size) { |
93 | error_msg_and_die("Cant resolve long filename"); | 93 | bb_error_msg_and_die("Cant resolve long filename"); |
94 | } | 94 | } |
95 | typed->name = xstrdup(ar_long_names + long_offset); | 95 | typed->name = bb_xstrdup(ar_long_names + long_offset); |
96 | } | 96 | } |
97 | #else | 97 | #else |
98 | error_msg_and_die("long filenames not supported"); | 98 | bb_error_msg_and_die("long filenames not supported"); |
99 | #endif | 99 | #endif |
100 | } else { | 100 | } else { |
101 | /* short filenames */ | 101 | /* short filenames */ |
102 | typed->name = xstrndup(ar.formated.name, 16); | 102 | typed->name = bb_xstrndup(ar.formated.name, 16); |
103 | } | 103 | } |
104 | 104 | ||
105 | typed->name[strcspn(typed->name, " /")] = '\0'; | 105 | typed->name[strcspn(typed->name, " /")] = '\0'; |
diff --git a/archival/libunarchive/get_header_cpio.c b/archival/libunarchive/get_header_cpio.c index ea0857840..975e2a4bd 100644 --- a/archival/libunarchive/get_header_cpio.c +++ b/archival/libunarchive/get_header_cpio.c | |||
@@ -46,7 +46,7 @@ extern char get_header_cpio(archive_handle_t *archive_handle) | |||
46 | oldtmp = NULL; | 46 | oldtmp = NULL; |
47 | 47 | ||
48 | while (tmp) { | 48 | while (tmp) { |
49 | error_msg_and_die("need to fix this\n"); | 49 | bb_error_msg_and_die("need to fix this\n"); |
50 | if (tmp->entry->link_name) { /* Found a hardlink ready to be extracted */ | 50 | if (tmp->entry->link_name) { /* Found a hardlink ready to be extracted */ |
51 | file_header = tmp->entry; | 51 | file_header = tmp->entry; |
52 | if (oldtmp) { | 52 | if (oldtmp) { |
@@ -78,11 +78,11 @@ extern char get_header_cpio(archive_handle_t *archive_handle) | |||
78 | cpio_header[2], | 78 | cpio_header[2], |
79 | cpio_header[3], | 79 | cpio_header[3], |
80 | cpio_header[4]); | 80 | cpio_header[4]); |
81 | error_msg_and_die("Unsupported cpio format"); | 81 | bb_error_msg_and_die("Unsupported cpio format"); |
82 | } | 82 | } |
83 | 83 | ||
84 | if ((cpio_header[5] != '1') && (cpio_header[5] != '2')) { | 84 | if ((cpio_header[5] != '1') && (cpio_header[5] != '2')) { |
85 | error_msg_and_die("Unsupported cpio format, use newc or crc"); | 85 | bb_error_msg_and_die("Unsupported cpio format, use newc or crc"); |
86 | } | 86 | } |
87 | 87 | ||
88 | { | 88 | { |
@@ -109,7 +109,7 @@ extern char get_header_cpio(archive_handle_t *archive_handle) | |||
109 | hardlinks_t *tmp = saved_hardlinks; | 109 | hardlinks_t *tmp = saved_hardlinks; |
110 | hardlinks_t *oldtmp = NULL; | 110 | hardlinks_t *oldtmp = NULL; |
111 | while (tmp) { | 111 | while (tmp) { |
112 | error_msg("%s not created: cannot resolve hardlink", tmp->entry->name); | 112 | bb_error_msg("%s not created: cannot resolve hardlink", tmp->entry->name); |
113 | oldtmp = tmp; | 113 | oldtmp = tmp; |
114 | tmp = tmp->next; | 114 | tmp = tmp->next; |
115 | free (oldtmp->entry->name); | 115 | free (oldtmp->entry->name); |
@@ -142,13 +142,13 @@ extern char get_header_cpio(archive_handle_t *archive_handle) | |||
142 | pending_hardlinks = 1; | 142 | pending_hardlinks = 1; |
143 | while (tmp) { | 143 | while (tmp) { |
144 | if (tmp->inode == inode) { | 144 | if (tmp->inode == inode) { |
145 | tmp->entry->link_name = xstrdup(file_header->name); | 145 | tmp->entry->link_name = bb_xstrdup(file_header->name); |
146 | nlink--; | 146 | nlink--; |
147 | } | 147 | } |
148 | tmp = tmp->next; | 148 | tmp = tmp->next; |
149 | } | 149 | } |
150 | if (nlink > 1) { | 150 | if (nlink > 1) { |
151 | error_msg("error resolving hardlink: did you create the archive with GNU cpio 2.0-2.2?"); | 151 | bb_error_msg("error resolving hardlink: did you create the archive with GNU cpio 2.0-2.2?"); |
152 | } | 152 | } |
153 | } | 153 | } |
154 | } | 154 | } |
@@ -165,11 +165,11 @@ extern char get_header_cpio(archive_handle_t *archive_handle) | |||
165 | if ((archive_handle->flags & ARCHIVE_EXTRACT_UNCONDITIONAL) || (statbuf.st_mtime < file_header->mtime)) { | 165 | if ((archive_handle->flags & ARCHIVE_EXTRACT_UNCONDITIONAL) || (statbuf.st_mtime < file_header->mtime)) { |
166 | /* Remove file if flag set or its older than the file to be extracted */ | 166 | /* Remove file if flag set or its older than the file to be extracted */ |
167 | if (unlink(file_header->name) == -1) { | 167 | if (unlink(file_header->name) == -1) { |
168 | perror_msg_and_die("Couldnt remove old file"); | 168 | bb_perror_msg_and_die("Couldnt remove old file"); |
169 | } | 169 | } |
170 | } else { | 170 | } else { |
171 | if (! archive_handle->flags & ARCHIVE_EXTRACT_QUIET) { | 171 | if (! archive_handle->flags & ARCHIVE_EXTRACT_QUIET) { |
172 | error_msg("%s not created: newer or same age file exists", file_header->name); | 172 | bb_error_msg("%s not created: newer or same age file exists", file_header->name); |
173 | } | 173 | } |
174 | extract_flag = FALSE; | 174 | extract_flag = FALSE; |
175 | } | 175 | } |
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index 2cb141ede..365f464dd 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c | |||
@@ -75,7 +75,7 @@ extern char get_header_tar(archive_handle_t *archive_handle) | |||
75 | #ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY | 75 | #ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY |
76 | if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0) | 76 | if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0) |
77 | #endif | 77 | #endif |
78 | error_msg_and_die("Invalid tar magic"); | 78 | bb_error_msg_and_die("Invalid tar magic"); |
79 | } | 79 | } |
80 | /* Do checksum on headers */ | 80 | /* Do checksum on headers */ |
81 | for (i = 0; i < 148 ; i++) { | 81 | for (i = 0; i < 148 ; i++) { |
@@ -86,7 +86,7 @@ extern char get_header_tar(archive_handle_t *archive_handle) | |||
86 | sum += tar.raw[i]; | 86 | sum += tar.raw[i]; |
87 | } | 87 | } |
88 | if (sum != strtol(tar.formated.chksum, NULL, 8)) { | 88 | if (sum != strtol(tar.formated.chksum, NULL, 8)) { |
89 | error_msg("Invalid tar header checksum"); | 89 | bb_error_msg("Invalid tar header checksum"); |
90 | return(EXIT_FAILURE); | 90 | return(EXIT_FAILURE); |
91 | } | 91 | } |
92 | 92 | ||
@@ -116,7 +116,7 @@ extern char get_header_tar(archive_handle_t *archive_handle) | |||
116 | file_header->size = strtol(tar.formated.size, NULL, 8); | 116 | file_header->size = strtol(tar.formated.size, NULL, 8); |
117 | file_header->mtime = strtol(tar.formated.mtime, NULL, 8); | 117 | file_header->mtime = strtol(tar.formated.mtime, NULL, 8); |
118 | file_header->link_name = (tar.formated.linkname[0] != '\0') ? | 118 | file_header->link_name = (tar.formated.linkname[0] != '\0') ? |
119 | xstrdup(tar.formated.linkname) : NULL; | 119 | bb_xstrdup(tar.formated.linkname) : NULL; |
120 | file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) + | 120 | file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) + |
121 | strtol(tar.formated.devminor, NULL, 8)); | 121 | strtol(tar.formated.devminor, NULL, 8)); |
122 | 122 | ||
@@ -129,7 +129,7 @@ extern char get_header_tar(archive_handle_t *archive_handle) | |||
129 | file_header->mode |= S_IFREG; | 129 | file_header->mode |= S_IFREG; |
130 | break; | 130 | break; |
131 | case '1': | 131 | case '1': |
132 | error_msg("Internal hard link not supported"); | 132 | bb_error_msg("Internal hard link not supported"); |
133 | break; | 133 | break; |
134 | case '2': | 134 | case '2': |
135 | file_header->mode |= S_IFLNK; | 135 | file_header->mode |= S_IFLNK; |
@@ -170,7 +170,7 @@ extern char get_header_tar(archive_handle_t *archive_handle) | |||
170 | case 'N': | 170 | case 'N': |
171 | case 'S': | 171 | case 'S': |
172 | case 'V': | 172 | case 'V': |
173 | error_msg("Ignoring GNU extension type %c", tar.formated.typeflag); | 173 | bb_error_msg("Ignoring GNU extension type %c", tar.formated.typeflag); |
174 | # endif | 174 | # endif |
175 | } | 175 | } |
176 | #endif | 176 | #endif |
diff --git a/archival/libunarchive/get_header_tar_gz.c b/archival/libunarchive/get_header_tar_gz.c index a4355d24c..7792432ae 100644 --- a/archival/libunarchive/get_header_tar_gz.c +++ b/archival/libunarchive/get_header_tar_gz.c | |||
@@ -25,7 +25,7 @@ extern char get_header_tar_gz(archive_handle_t *archive_handle) | |||
25 | 25 | ||
26 | archive_xread_all(archive_handle, &magic, 2); | 26 | archive_xread_all(archive_handle, &magic, 2); |
27 | if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) { | 27 | if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) { |
28 | error_msg_and_die("Invalid gzip magic"); | 28 | bb_error_msg_and_die("Invalid gzip magic"); |
29 | } | 29 | } |
30 | 30 | ||
31 | check_header_gzip(archive_handle->src_fd); | 31 | check_header_gzip(archive_handle->src_fd); |
diff --git a/archival/libunarchive/header_verbose_list.c b/archival/libunarchive/header_verbose_list.c index ff7b3bca2..6739dd393 100644 --- a/archival/libunarchive/header_verbose_list.c +++ b/archival/libunarchive/header_verbose_list.c | |||
@@ -9,7 +9,7 @@ extern void header_verbose_list(const file_header_t *file_header) | |||
9 | struct tm *mtime = localtime(&file_header->mtime); | 9 | struct tm *mtime = localtime(&file_header->mtime); |
10 | 10 | ||
11 | printf("%s %d/%d%10u %4u-%02u-%02u %02u:%02u:%02u %s", | 11 | printf("%s %d/%d%10u %4u-%02u-%02u %02u:%02u:%02u %s", |
12 | mode_string(file_header->mode), | 12 | bb_mode_string(file_header->mode), |
13 | file_header->uid, | 13 | file_header->uid, |
14 | file_header->gid, | 14 | file_header->gid, |
15 | (unsigned int) file_header->size, | 15 | (unsigned int) file_header->size, |
diff --git a/archival/libunarchive/seek_by_jump.c b/archival/libunarchive/seek_by_jump.c index 282397616..578870d9b 100644 --- a/archival/libunarchive/seek_by_jump.c +++ b/archival/libunarchive/seek_by_jump.c | |||
@@ -30,6 +30,6 @@ extern void seek_by_jump(const archive_handle_t *archive_handle, const unsigned | |||
30 | seek_by_char(archive_handle, amount); | 30 | seek_by_char(archive_handle, amount); |
31 | } else | 31 | } else |
32 | #endif | 32 | #endif |
33 | perror_msg_and_die("Seek failure"); | 33 | bb_perror_msg_and_die("Seek failure"); |
34 | } | 34 | } |
35 | } | 35 | } |
diff --git a/archival/libunarchive/uncompress.c b/archival/libunarchive/uncompress.c index 192e98126..9851ca39d 100644 --- a/archival/libunarchive/uncompress.c +++ b/archival/libunarchive/uncompress.c | |||
@@ -121,14 +121,14 @@ extern int uncompress(int fd_in, int fd_out) | |||
121 | 121 | ||
122 | insize = 0; | 122 | insize = 0; |
123 | 123 | ||
124 | inbuf[0] = xread_char(fd_in); | 124 | inbuf[0] = bb_xread_char(fd_in); |
125 | 125 | ||
126 | maxbits = inbuf[0] & BIT_MASK; | 126 | maxbits = inbuf[0] & BIT_MASK; |
127 | block_mode = inbuf[0] & BLOCK_MODE; | 127 | block_mode = inbuf[0] & BLOCK_MODE; |
128 | maxmaxcode = MAXCODE(maxbits); | 128 | maxmaxcode = MAXCODE(maxbits); |
129 | 129 | ||
130 | if (maxbits > BITS) { | 130 | if (maxbits > BITS) { |
131 | error_msg("compressed with %d bits, can only handle %d bits", maxbits, | 131 | bb_error_msg("compressed with %d bits, can only handle %d bits", maxbits, |
132 | BITS); | 132 | BITS); |
133 | return -1; | 133 | return -1; |
134 | } | 134 | } |
@@ -227,11 +227,11 @@ extern int uncompress(int fd_in, int fd_out) | |||
227 | posbits -= n_bits; | 227 | posbits -= n_bits; |
228 | p = &inbuf[posbits >> 3]; | 228 | p = &inbuf[posbits >> 3]; |
229 | 229 | ||
230 | error_msg | 230 | bb_error_msg |
231 | ("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)", | 231 | ("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)", |
232 | insize, posbits, p[-1], p[0], p[1], p[2], p[3], | 232 | insize, posbits, p[-1], p[0], p[1], p[2], p[3], |
233 | (posbits & 07)); | 233 | (posbits & 07)); |
234 | error_msg("uncompress: corrupt input"); | 234 | bb_error_msg("uncompress: corrupt input"); |
235 | return -1; | 235 | return -1; |
236 | } | 236 | } |
237 | 237 | ||
diff --git a/archival/libunarchive/unpack_ar_archive.c b/archival/libunarchive/unpack_ar_archive.c index afa3672ad..e8f113bcf 100644 --- a/archival/libunarchive/unpack_ar_archive.c +++ b/archival/libunarchive/unpack_ar_archive.c | |||
@@ -26,7 +26,7 @@ extern void unpack_ar_archive(archive_handle_t *ar_archive) | |||
26 | 26 | ||
27 | archive_xread_all(ar_archive, magic, 7); | 27 | archive_xread_all(ar_archive, magic, 7); |
28 | if (strncmp(magic, "!<arch>", 7) != 0) { | 28 | if (strncmp(magic, "!<arch>", 7) != 0) { |
29 | error_msg_and_die("Invalid ar magic"); | 29 | bb_error_msg_and_die("Invalid ar magic"); |
30 | } | 30 | } |
31 | ar_archive->offset += 7; | 31 | ar_archive->offset += 7; |
32 | 32 | ||
diff --git a/archival/libunarchive/unzip.c b/archival/libunarchive/unzip.c index 3a7334ce9..2401cf831 100644 --- a/archival/libunarchive/unzip.c +++ b/archival/libunarchive/unzip.c | |||
@@ -150,7 +150,7 @@ static void fill_bytebuffer(void) | |||
150 | /* Leave the first 4 bytes empty so we can always unwind the bitbuffer | 150 | /* Leave the first 4 bytes empty so we can always unwind the bitbuffer |
151 | * to the front of the bytebuffer, leave 4 bytes free at end of tail | 151 | * to the front of the bytebuffer, leave 4 bytes free at end of tail |
152 | * so we can easily top up buffer in check_trailer_gzip() */ | 152 | * so we can easily top up buffer in check_trailer_gzip() */ |
153 | bytebuffer_size = 4 + xread(gunzip_src_fd, &bytebuffer[4], BYTEBUFFER_MAX - 8); | 153 | bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], BYTEBUFFER_MAX - 8); |
154 | bytebuffer_offset = 4; | 154 | bytebuffer_offset = 4; |
155 | } | 155 | } |
156 | } | 156 | } |
@@ -448,7 +448,7 @@ static int inflate_codes(huft_t * my_tl, huft_t * my_td, const unsigned int my_b | |||
448 | if ((e = (t = tl + ((unsigned) b & ml))->e) > 16) | 448 | if ((e = (t = tl + ((unsigned) b & ml))->e) > 16) |
449 | do { | 449 | do { |
450 | if (e == 99) { | 450 | if (e == 99) { |
451 | error_msg_and_die("inflate_codes error 1");; | 451 | bb_error_msg_and_die("inflate_codes error 1");; |
452 | } | 452 | } |
453 | b >>= t->b; | 453 | b >>= t->b; |
454 | k -= t->b; | 454 | k -= t->b; |
@@ -484,7 +484,7 @@ static int inflate_codes(huft_t * my_tl, huft_t * my_td, const unsigned int my_b | |||
484 | if ((e = (t = td + ((unsigned) b & md))->e) > 16) | 484 | if ((e = (t = td + ((unsigned) b & md))->e) > 16) |
485 | do { | 485 | do { |
486 | if (e == 99) | 486 | if (e == 99) |
487 | error_msg_and_die("inflate_codes error 2");; | 487 | bb_error_msg_and_die("inflate_codes error 2");; |
488 | b >>= t->b; | 488 | b >>= t->b; |
489 | k -= t->b; | 489 | k -= t->b; |
490 | e -= 16; | 490 | e -= 16; |
@@ -821,7 +821,7 @@ static int inflate_block(int *e) | |||
821 | 821 | ||
822 | if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) { | 822 | if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) { |
823 | if (i == 1) { | 823 | if (i == 1) { |
824 | error_msg_and_die("Incomplete literal tree"); | 824 | bb_error_msg_and_die("Incomplete literal tree"); |
825 | huft_free(tl); | 825 | huft_free(tl); |
826 | } | 826 | } |
827 | return i; /* incomplete code set */ | 827 | return i; /* incomplete code set */ |
@@ -830,7 +830,7 @@ static int inflate_block(int *e) | |||
830 | bd = dbits; | 830 | bd = dbits; |
831 | if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) { | 831 | if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) { |
832 | if (i == 1) { | 832 | if (i == 1) { |
833 | error_msg_and_die("incomplete distance tree"); | 833 | bb_error_msg_and_die("incomplete distance tree"); |
834 | huft_free(td); | 834 | huft_free(td); |
835 | } | 835 | } |
836 | huft_free(tl); | 836 | huft_free(tl); |
@@ -846,7 +846,7 @@ static int inflate_block(int *e) | |||
846 | } | 846 | } |
847 | default: | 847 | default: |
848 | /* bad block type */ | 848 | /* bad block type */ |
849 | error_msg_and_die("bad block type %d\n", t); | 849 | bb_error_msg_and_die("bad block type %d\n", t); |
850 | } | 850 | } |
851 | } | 851 | } |
852 | 852 | ||
@@ -884,7 +884,7 @@ static int inflate_get_next_window(void) | |||
884 | break; | 884 | break; |
885 | case -2: ret = inflate_codes(0,0,0,0,0); | 885 | case -2: ret = inflate_codes(0,0,0,0,0); |
886 | break; | 886 | break; |
887 | default: error_msg_and_die("inflate error %d", method); | 887 | default: bb_error_msg_and_die("inflate error %d", method); |
888 | } | 888 | } |
889 | 889 | ||
890 | if (ret == 1) { | 890 | if (ret == 1) { |
@@ -975,16 +975,16 @@ extern void GZ_gzReadClose(void) | |||
975 | ssize_t nread, nwrote; | 975 | ssize_t nread, nwrote; |
976 | 976 | ||
977 | GZ_gzReadOpen(in, 0, 0); | 977 | GZ_gzReadOpen(in, 0, 0); |
978 | while(1) { // Robbed from copyfd.c | 978 | while(1) { // Robbed from bb_copyfd.c |
979 | nread = read_gz(in, buf, sizeof(buf)); | 979 | nread = read_gz(in, buf, sizeof(buf)); |
980 | if (nread == 0) break; // no data to write | 980 | if (nread == 0) break; // no data to write |
981 | else if (nread == -1) { | 981 | else if (nread == -1) { |
982 | perror_msg("read"); | 982 | bb_perror_msg("read"); |
983 | return -1; | 983 | return -1; |
984 | } | 984 | } |
985 | nwrote = full_write(out, buf, nread); | 985 | nwrote = bb_full_write(out, buf, nread); |
986 | if (nwrote == -1) { | 986 | if (nwrote == -1) { |
987 | perror_msg("write"); | 987 | bb_perror_msg("write"); |
988 | return -1; | 988 | return -1; |
989 | } | 989 | } |
990 | } | 990 | } |
@@ -998,9 +998,9 @@ extern int inflate(int in, int out) | |||
998 | GZ_gzReadOpen(in, 0, 0); | 998 | GZ_gzReadOpen(in, 0, 0); |
999 | while(1) { | 999 | while(1) { |
1000 | int ret = inflate_get_next_window(); | 1000 | int ret = inflate_get_next_window(); |
1001 | nwrote = full_write(out, gunzip_window, gunzip_outbuf_count); | 1001 | nwrote = bb_full_write(out, gunzip_window, gunzip_outbuf_count); |
1002 | if (nwrote == -1) { | 1002 | if (nwrote == -1) { |
1003 | perror_msg("write"); | 1003 | bb_perror_msg("write"); |
1004 | return -1; | 1004 | return -1; |
1005 | } | 1005 | } |
1006 | if (ret == 0) break; | 1006 | if (ret == 0) break; |
@@ -1017,7 +1017,7 @@ extern void check_trailer_gzip(int src_fd) | |||
1017 | /* top up the input buffer with the rest of the trailer */ | 1017 | /* top up the input buffer with the rest of the trailer */ |
1018 | count = bytebuffer_size - bytebuffer_offset; | 1018 | count = bytebuffer_size - bytebuffer_offset; |
1019 | if (count < 8) { | 1019 | if (count < 8) { |
1020 | xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count); | 1020 | bb_xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count); |
1021 | bytebuffer_size += 8 - count; | 1021 | bytebuffer_size += 8 - count; |
1022 | } | 1022 | } |
1023 | for (count = 0; count != 4; count++) { | 1023 | for (count = 0; count != 4; count++) { |
@@ -1027,14 +1027,14 @@ extern void check_trailer_gzip(int src_fd) | |||
1027 | 1027 | ||
1028 | /* Validate decompression - crc */ | 1028 | /* Validate decompression - crc */ |
1029 | if (stored_crc != (gunzip_crc ^ 0xffffffffL)) { | 1029 | if (stored_crc != (gunzip_crc ^ 0xffffffffL)) { |
1030 | error_msg_and_die("crc error"); | 1030 | bb_error_msg_and_die("crc error"); |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | /* Validate decompression - size */ | 1033 | /* Validate decompression - size */ |
1034 | if (gunzip_bytes_out != | 1034 | if (gunzip_bytes_out != |
1035 | (bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) | | 1035 | (bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) | |
1036 | (bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) { | 1036 | (bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) { |
1037 | error_msg_and_die("Incorrect length, but crc is correct"); | 1037 | bb_error_msg_and_die("Incorrect length, but crc is correct"); |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | } | 1040 | } |