diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-07-22 11:36:55 +0300 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-07-22 11:36:55 +0300 |
commit | 680a3015114ce0375604a389139831f242769f60 (patch) | |
tree | db337a4afb34fa2f4ad6b619ec9cf06a107dc08a /src/gunzip.c | |
parent | 772e4aa26a2a0b21b667c54a11e05eae183e0915 (diff) | |
download | apk-tools-680a3015114ce0375604a389139831f242769f60.tar.gz apk-tools-680a3015114ce0375604a389139831f242769f60.tar.bz2 apk-tools-680a3015114ce0375604a389139831f242769f60.tar.xz apk-tools-680a3015114ce0375604a389139831f242769f60.zip |
various: installation fixes
- extract everything as .apk-new and overwrite only after data
has been checksummed
- url construction fixes (to work with simple http servers)
- end of gunzip stream fixed
- remove oneshot digesting flag for now as it's usage was broken
Diffstat (limited to 'src/gunzip.c')
-rw-r--r-- | src/gunzip.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gunzip.c b/src/gunzip.c index 8ccfbab..f14b396 100644 --- a/src/gunzip.c +++ b/src/gunzip.c @@ -50,7 +50,8 @@ static size_t gzi_read(void *stream, void *ptr, size_t size) if (gis->zs.avail_in == 0) { apk_blob_t blob; - if (gis->cb != NULL && gis->cbprev != NULL) { + if (gis->cb != NULL && gis->cbprev != NULL && + gis->cbprev != gis->zs.next_in) { gis->cb(gis->cbctx, APK_MPART_DATA, APK_BLOB_PTR_LEN(gis->cbprev, (void *)gis->zs.next_in - gis->cbprev)); @@ -63,16 +64,15 @@ static size_t gzi_read(void *stream, void *ptr, size_t size) gis->err = -1; goto ret; } else if (gis->zs.avail_in == 0) { + gis->err = 1; if (gis->cb != NULL) { r = gis->cb(gis->cbctx, APK_MPART_END, APK_BLOB_NULL); - if (r != 0) { - if (r > 0) - r = -1; + if (r > 0) + r = -1; + if (r != 0) gis->err = r; - } - } else - gis->err = 1; + } goto ret; } } @@ -107,7 +107,7 @@ static size_t gzi_read(void *stream, void *ptr, size_t size) ret: if (size - gis->zs.avail_out == 0) - return gis->err; + return gis->err < 0 ? gis->err : 0; return size - gis->zs.avail_out; } |