diff options
Diffstat (limited to 'archival')
-rw-r--r-- | archival/bbunzip.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/decompress_unxz.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index 1c8d0ab55..86adb6e24 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c | |||
@@ -374,7 +374,7 @@ char* make_new_name_unxz(char *filename) | |||
374 | static | 374 | static |
375 | IF_DESKTOP(long long) int unpack_unxz(unpack_info_t *info UNUSED_PARAM) | 375 | IF_DESKTOP(long long) int unpack_unxz(unpack_info_t *info UNUSED_PARAM) |
376 | { | 376 | { |
377 | return unpack_xz_stream_stdin(); | 377 | return unpack_xz_stream(STDIN_FILENO, STDOUT_FILENO); |
378 | } | 378 | } |
379 | int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 379 | int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
380 | int unxz_main(int argc UNUSED_PARAM, char **argv) | 380 | int unxz_main(int argc UNUSED_PARAM, char **argv) |
diff --git a/archival/libunarchive/decompress_unxz.c b/archival/libunarchive/decompress_unxz.c index 0ae789160..9edc2461a 100644 --- a/archival/libunarchive/decompress_unxz.c +++ b/archival/libunarchive/decompress_unxz.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * by Lasse Collin <lasse.collin@tukaani.org> | 3 | * by Lasse Collin <lasse.collin@tukaani.org> |
4 | * and Igor Pavlov <http://7-zip.org/> | 4 | * and Igor Pavlov <http://7-zip.org/> |
5 | * | 5 | * |
6 | * See README file in unxzbz/ directory for more information. | 6 | * See README file in unxz/ directory for more information. |
7 | * | 7 | * |
8 | * This file is: | 8 | * This file is: |
9 | * Copyright (C) 2010 Denys Vlasenko <vda.linux@googlemail.com> | 9 | * Copyright (C) 2010 Denys Vlasenko <vda.linux@googlemail.com> |
@@ -48,7 +48,7 @@ static uint32_t xz_crc32(uint32_t *crc32_table, | |||
48 | #include "unxz/xz_stream.h" | 48 | #include "unxz/xz_stream.h" |
49 | 49 | ||
50 | IF_DESKTOP(long long) int FAST_FUNC | 50 | IF_DESKTOP(long long) int FAST_FUNC |
51 | unpack_xz_stream_stdin(void) | 51 | unpack_xz_stream(int src_fd, int dst_fd) |
52 | { | 52 | { |
53 | struct xz_buf iobuf; | 53 | struct xz_buf iobuf; |
54 | struct xz_dec *state; | 54 | struct xz_dec *state; |
@@ -79,7 +79,7 @@ unpack_xz_stream_stdin(void) | |||
79 | iobuf.in_pos = 0; | 79 | iobuf.in_pos = 0; |
80 | rd = IN_SIZE - insz; | 80 | rd = IN_SIZE - insz; |
81 | if (rd) { | 81 | if (rd) { |
82 | rd = safe_read(STDIN_FILENO, membuf + insz, rd); | 82 | rd = safe_read(src_fd, membuf + insz, rd); |
83 | if (rd < 0) { | 83 | if (rd < 0) { |
84 | bb_error_msg("read error"); | 84 | bb_error_msg("read error"); |
85 | total = -1; | 85 | total = -1; |
@@ -94,10 +94,11 @@ unpack_xz_stream_stdin(void) | |||
94 | // iobuf.in_pos, iobuf.in_size, iobuf.out_pos, iobuf.out_size, r); | 94 | // iobuf.in_pos, iobuf.in_size, iobuf.out_pos, iobuf.out_size, r); |
95 | outpos = iobuf.out_pos; | 95 | outpos = iobuf.out_pos; |
96 | if (outpos) { | 96 | if (outpos) { |
97 | xwrite(STDOUT_FILENO, iobuf.out, outpos); | 97 | xwrite(dst_fd, iobuf.out, outpos); |
98 | IF_DESKTOP(total += outpos;) | 98 | IF_DESKTOP(total += outpos;) |
99 | } | 99 | } |
100 | if (r == XZ_STREAM_END | 100 | if (r == XZ_STREAM_END |
101 | /* this happens even with well-formed files: */ | ||
101 | || (r == XZ_BUF_ERROR && insz == 0 && outpos == 0) | 102 | || (r == XZ_BUF_ERROR && insz == 0 && outpos == 0) |
102 | ) { | 103 | ) { |
103 | break; | 104 | break; |