diff options
Diffstat (limited to 'src/io_gunzip.c')
-rw-r--r-- | src/io_gunzip.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/io_gunzip.c b/src/io_gunzip.c index e1a23d6..3cab464 100644 --- a/src/io_gunzip.c +++ b/src/io_gunzip.c @@ -67,17 +67,18 @@ static ssize_t gzi_read(struct apk_istream *is, void *ptr, size_t size) APK_BLOB_PTR_LEN(gis->cbprev, (void *)gis->zs.next_in - gis->cbprev)); } - blob = apk_istream_get_all(gis->zis); + r = apk_istream_get_all(gis->zis, &blob); gis->cbprev = blob.ptr; gis->zs.avail_in = blob.len; gis->zs.next_in = (void *) gis->cbprev; - if (blob.len < 0) { - gis->is.err = blob.len; - goto ret; - } else if (gis->zs.avail_in == 0) { - gis->is.err = 1; - gis->cbarg = APK_BLOB_NULL; - gzi_boundary_change(gis); + if (r < 0) { + if (r == -APKE_EOF) { + gis->is.err = 1; + gis->cbarg = APK_BLOB_NULL; + gzi_boundary_change(gis); + } else { + gis->is.err = r; + } goto ret; } } |