diff options
Diffstat (limited to 'src/gzip.c')
-rw-r--r-- | src/gzip.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -229,6 +229,21 @@ opkg_opk_gzip_written(struct opkg_opk_gzip *gzip) } int +opkg_opk_gzip_finish_write(struct opkg_opk_gzip *gzip) +{ + /* Sanity check */ + if (gzip->dir != _OPKG_OPK_GZIP_DIR_WRITE) { + return OPKG_OPK_ERROR; + } + + if (gzip->written > 0 && _opkg_opk_gzip_write(gzip, NULL, 0, 1) != + OPKG_OPK_END) { + return OPKG_OPK_ERROR; + } + return OPKG_OPK_OK; +} + +int opkg_opk_gzip_free(struct opkg_opk_gzip *gzip) { int ret; @@ -239,9 +254,6 @@ 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; } |