summaryrefslogtreecommitdiffstats
path: root/src/gzip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gzip.c')
-rw-r--r--src/gzip.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gzip.c b/src/gzip.c
index 736cbd7..1263ffc 100644
--- a/src/gzip.c
+++ b/src/gzip.c
@@ -174,8 +174,8 @@ opkg_opk_gzip_read(struct opkg_opk_gzip *gzip, void *record)
}
}
-int
-opkg_opk_gzip_write(struct opkg_opk_gzip *gzip, void *record, size_t size,
+static int
+_opkg_opk_gzip_write(struct opkg_opk_gzip *gzip, void *record, size_t size,
int last)
{
/* Sanity check */
@@ -223,6 +223,16 @@ opkg_opk_gzip_write(struct opkg_opk_gzip *gzip, void *record, size_t size,
}
int
+opkg_opk_gzip_write(struct opkg_opk_gzip *gzip, void *record, size_t size)
+{
+ if (_opkg_opk_gzip_write(gzip, record, size, 0) == OPKG_OPK_OK) {
+ return OPKG_OPK_OK;
+ } else {
+ return OPKG_OPK_ERROR;
+ }
+}
+
+int
opkg_opk_gzip_free(struct opkg_opk_gzip *gzip)
{
int ret;
@@ -233,6 +243,9 @@ opkg_opk_gzip_free(struct opkg_opk_gzip *gzip)
ret = OPKG_OPK_ERROR;
}
} else {
+ if (_opkg_opk_gzip_write(gzip, NULL, 0, 1) != OPKG_OPK_END) {
+ ret = OPKG_OPK_ERROR;
+ }
if (deflateEnd(&gzip->stream) != Z_OK) {
ret = OPKG_OPK_ERROR;
}