diff options
author | Denys Vlasenko | 2012-03-06 16:23:50 +0100 |
---|---|---|
committer | Denys Vlasenko | 2012-03-06 16:23:50 +0100 |
commit | 59655077c5bf176f01d8d277665ebb92263704ed (patch) | |
tree | 0d4393ea09ebe90e35866d27041faf6372f6e87e /archival/libarchive/decompress_uncompress.c | |
parent | 17eedcad9406c43beddab3906c8c693626c351fb (diff) | |
download | busybox-59655077c5bf176f01d8d277665ebb92263704ed.zip busybox-59655077c5bf176f01d8d277665ebb92263704ed.tar.gz |
preparatory cleanups for seamless uncompression improvements
unpack_gz_stream_with_info: fix buggy error check
man: fix possible accesses past the end of a string
move seamless uncompression helpers from read_printf.c to open_transformer.c
function old new delta
show_manpage 153 212 +59
unpack_gz_stream_with_info 520 539 +19
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/libarchive/decompress_uncompress.c')
-rw-r--r-- | archival/libarchive/decompress_uncompress.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/archival/libarchive/decompress_uncompress.c b/archival/libarchive/decompress_uncompress.c index c6040d0..289f9e2 100644 --- a/archival/libarchive/decompress_uncompress.c +++ b/archival/libarchive/decompress_uncompress.c @@ -73,7 +73,7 @@ */ IF_DESKTOP(long long) int FAST_FUNC -unpack_Z_stream(int fd_in, int fd_out) +unpack_Z_stream(int src_fd, int dst_fd) { IF_DESKTOP(long long total_written = 0;) IF_DESKTOP(long long) int retval = -1; @@ -105,14 +105,14 @@ unpack_Z_stream(int fd_in, int fd_out) inbuf = xzalloc(IBUFSIZ + 64); outbuf = xzalloc(OBUFSIZ + 2048); - htab = xzalloc(HSIZE); /* wsn't zeroed out before, maybe can xmalloc? */ + htab = xzalloc(HSIZE); /* wasn't zeroed out before, maybe can xmalloc? */ codetab = xzalloc(HSIZE * sizeof(codetab[0])); insize = 0; /* xread isn't good here, we have to return - caller may want * to do some cleanup (e.g. delete incomplete unpacked file etc) */ - if (full_read(fd_in, inbuf, 1) != 1) { + if (full_read(src_fd, inbuf, 1) != 1) { bb_error_msg("short read"); goto err; } @@ -162,7 +162,7 @@ unpack_Z_stream(int fd_in, int fd_out) } if (insize < (int) (IBUFSIZ + 64) - IBUFSIZ) { - rsize = safe_read(fd_in, inbuf + insize, IBUFSIZ); + rsize = safe_read(src_fd, inbuf + insize, IBUFSIZ); if (rsize < 0) bb_error_msg_and_die(bb_msg_read_error); insize += rsize; @@ -268,7 +268,7 @@ unpack_Z_stream(int fd_in, int fd_out) } if (outpos >= OBUFSIZ) { - xwrite(fd_out, outbuf, outpos); + xwrite(dst_fd, outbuf, outpos); IF_DESKTOP(total_written += outpos;) outpos = 0; } @@ -296,7 +296,7 @@ unpack_Z_stream(int fd_in, int fd_out) } while (rsize > 0); if (outpos > 0) { - xwrite(fd_out, outbuf, outpos); + xwrite(dst_fd, outbuf, outpos); IF_DESKTOP(total_written += outpos;) } |