summaryrefslogtreecommitdiff
authorDenys Vlasenko <vda.linux@googlemail.com>2016-06-20 09:42:00 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2016-06-20 09:42:00 (GMT)
commitdf3ec0e2f70d67f1f880bee933985732b455ee76 (patch)
tree2c4be235948345680eb72f1297a874429788327e
parent984b0a613aaf1cdf48c2e2af08c8466a7bad8307 (diff)
downloadbusybox-df3ec0e2f70d67f1f880bee933985732b455ee76.zip
busybox-df3ec0e2f70d67f1f880bee933985732b455ee76.tar.gz
busybox-df3ec0e2f70d67f1f880bee933985732b455ee76.tar.bz2
libarchive: fix open_zipped()
Last commit broke it (on both MMU and NOMMU) Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat
-rw-r--r--archival/libarchive/open_transformer.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c
index d93c836..dd15a9b 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
*/
// USE_FOR_MMU(xstate->xformer = copy_stream;)
// USE_FOR_NOMMU(xstate->xformer_prog = "cat";)
- /* fall through to seeking bck over bytes we read earlier */
found_magic:
return xstate;
@@ -289,16 +288,22 @@ int FAST_FUNC open_zipped(const char *fname, int fail_if_not_compressed)
return -1;
fd = xstate->src_fd;
- if (xstate->xformer) {
# if BB_MMU
- fork_transformer_with_no_sig(xstate->src_fd, xstate->xformer);
-# else
+ if (xstate->xformer) {
+ fork_transformer_with_no_sig(fd, xstate->xformer);
+ } else {
+ /* the file is not compressed */
xlseek(fd, - xstate->signature_skipped, SEEK_CUR);
xstate->signature_skipped = 0;
- fork_transformer_with_sig(xstate->src_fd, xstate->xformer, xstate->xformer_prog);
-# endif
}
- /* else: the file is not compressed */
+# else
+ /* NOMMU can't avoid the seek :( */
+ xlseek(fd, - xstate->signature_skipped, SEEK_CUR);
+ xstate->signature_skipped = 0;
+ if (xstate->xformer) {
+ fork_transformer_with_sig(fd, xstate->xformer, xstate->xformer_prog);
+ } /* esle: the file is not compressed */
+# endif
free(xstate);
return fd;