summaryrefslogtreecommitdiff
path: root/src/gunzip.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-03-10 13:04:14 +0200
committerTimo Teräs <timo.teras@iki.fi>2015-03-10 13:15:31 +0200
commit2a6896b2b4809849441756046ee7d8ad34abab34 (patch)
treee42c99fc0a6bb2fa35fcce241776d9208a8c0471 /src/gunzip.c
parent417755cb2e16dee1cb674cbe2b2942c156e0b5da (diff)
downloadapk-tools-2a6896b2b4809849441756046ee7d8ad34abab34.tar.gz
apk-tools-2a6896b2b4809849441756046ee7d8ad34abab34.tar.bz2
apk-tools-2a6896b2b4809849441756046ee7d8ad34abab34.tar.xz
apk-tools-2a6896b2b4809849441756046ee7d8ad34abab34.zip
rework error handling for read streams
Diffstat (limited to 'src/gunzip.c')
-rw-r--r--src/gunzip.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gunzip.c b/src/gunzip.c
index 45e3b3c..366094f 100644
--- a/src/gunzip.c
+++ b/src/gunzip.c
@@ -170,7 +170,7 @@ struct apk_istream *apk_bstream_gunzip_mpart(struct apk_bstream *bs,
return &gis->is;
err:
bs->close(bs, NULL);
- return NULL;
+ return ERR_PTR(-ENOMEM);
}
struct apk_gzip_ostream {
@@ -236,8 +236,7 @@ struct apk_ostream *apk_ostream_gzip(struct apk_ostream *output)
if (IS_ERR_OR_NULL(output)) return ERR_CAST(output);
gos = malloc(sizeof(struct apk_gzip_ostream));
- if (gos == NULL)
- goto err;
+ if (gos == NULL) goto err;
*gos = (struct apk_gzip_ostream) {
.os.write = gzo_write,
@@ -254,6 +253,6 @@ struct apk_ostream *apk_ostream_gzip(struct apk_ostream *output)
return &gos->os;
err:
output->close(output);
- return NULL;
+ return ERR_PTR(-ENOMEM);
}