]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Straighten out the close handling. archive_read_close() now
authorTim Kientzle <kientzle@gmail.com>
Thu, 25 Dec 2008 14:31:49 +0000 (09:31 -0500)
committerTim Kientzle <kientzle@gmail.com>
Thu, 25 Dec 2008 14:31:49 +0000 (09:31 -0500)
walks the decompression filter list, invoking the close handler
on each one.  In particular, this means that the compress handler
should not recursively invoke close on it's source.

SVN-Revision: 282

libarchive/archive_read.c
libarchive/archive_read_support_compression_compress.c

index a36e0c5ed9ade93c6a728463467ac119c71b2373..a1f40238f6a8ff58b00baed321091d607bb9cd58 100644 (file)
@@ -595,11 +595,12 @@ archive_read_close(struct archive *_a)
        /* TODO: Clean up the formatters. */
 
        /* Clean up the stream pipeline. */
-       if (a->source != NULL) {
+       while (a->source != NULL) {
+               struct archive_read_source *t = a->source->upstream;
                r1 = (a->source->close)(a->source);
                if (r1 < r)
                        r = r1;
-               a->source = NULL;
+               a->source = t;
        }
 
        /* Release the reader objects. */
index 24567ae04d6d24e926b84a0094b9a901e5e5fd22..329173738f3a17a073abb457ada61ebae063ccd4 100644 (file)
@@ -339,7 +339,6 @@ compress_source_close(struct archive_read_source *self)
 {
        struct private_data *state = (struct private_data *)self->data;
 
-       self->upstream->close(self->upstream);
        free(state->out_block);
        free(state);
        free(self);