diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-06-20 11:42:00 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-06-20 11:42:00 +0200 |
| commit | df3ec0e2f70d67f1f880bee933985732b455ee76 (patch) | |
| tree | 2c4be235948345680eb72f1297a874429788327e | |
| parent | 984b0a613aaf1cdf48c2e2af08c8466a7bad8307 (diff) | |
| download | busybox-w32-df3ec0e2f70d67f1f880bee933985732b455ee76.tar.gz busybox-w32-df3ec0e2f70d67f1f880bee933985732b455ee76.tar.bz2 busybox-w32-df3ec0e2f70d67f1f880bee933985732b455ee76.zip | |
libarchive: fix open_zipped()
Last commit broke it (on both MMU and NOMMU)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | archival/libarchive/open_transformer.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c index d93c8366f..dd15a9b1f 100644 --- a/archival/libarchive/open_transformer.c +++ b/archival/libarchive/open_transformer.c | |||
| @@ -220,7 +220,6 @@ static transformer_state_t *setup_transformer_on_fd(int fd, int fail_if_not_comp | |||
| 220 | */ | 220 | */ |
| 221 | // USE_FOR_MMU(xstate->xformer = copy_stream;) | 221 | // USE_FOR_MMU(xstate->xformer = copy_stream;) |
| 222 | // USE_FOR_NOMMU(xstate->xformer_prog = "cat";) | 222 | // USE_FOR_NOMMU(xstate->xformer_prog = "cat";) |
| 223 | /* fall through to seeking bck over bytes we read earlier */ | ||
| 224 | 223 | ||
| 225 | found_magic: | 224 | found_magic: |
| 226 | return xstate; | 225 | return xstate; |
| @@ -289,16 +288,22 @@ int FAST_FUNC open_zipped(const char *fname, int fail_if_not_compressed) | |||
| 289 | return -1; | 288 | return -1; |
| 290 | 289 | ||
| 291 | fd = xstate->src_fd; | 290 | fd = xstate->src_fd; |
| 292 | if (xstate->xformer) { | ||
| 293 | # if BB_MMU | 291 | # if BB_MMU |
| 294 | fork_transformer_with_no_sig(xstate->src_fd, xstate->xformer); | 292 | if (xstate->xformer) { |
| 295 | # else | 293 | fork_transformer_with_no_sig(fd, xstate->xformer); |
| 294 | } else { | ||
| 295 | /* the file is not compressed */ | ||
| 296 | xlseek(fd, - xstate->signature_skipped, SEEK_CUR); | 296 | xlseek(fd, - xstate->signature_skipped, SEEK_CUR); |
| 297 | xstate->signature_skipped = 0; | 297 | xstate->signature_skipped = 0; |
| 298 | fork_transformer_with_sig(xstate->src_fd, xstate->xformer, xstate->xformer_prog); | ||
| 299 | # endif | ||
| 300 | } | 298 | } |
| 301 | /* else: the file is not compressed */ | 299 | # else |
| 300 | /* NOMMU can't avoid the seek :( */ | ||
| 301 | xlseek(fd, - xstate->signature_skipped, SEEK_CUR); | ||
| 302 | xstate->signature_skipped = 0; | ||
| 303 | if (xstate->xformer) { | ||
| 304 | fork_transformer_with_sig(fd, xstate->xformer, xstate->xformer_prog); | ||
| 305 | } /* esle: the file is not compressed */ | ||
| 306 | # endif | ||
| 302 | 307 | ||
| 303 | free(xstate); | 308 | free(xstate); |
| 304 | return fd; | 309 | return fd; |
