diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-04-30 03:24:14 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-04-30 03:37:57 (EDT) |
commit | d159b5cf03212e9ecb848dd7eef5edc3ba1a7bba (patch) | |
tree | 0e2e375be7865329ae6c712f5ab93df282451119 /src | |
parent | 6b09c55d892e31a633075279bf9c1446b69d139e (diff) |
ustar: Add function to write trailer
Diffstat (limited to 'src')
-rw-r--r-- | src/ustar.c | 13 | ||||
-rw-r--r-- | src/ustar.h | 3 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/ustar.c b/src/ustar.c index 7fa64e2..e1771c3 100644 --- a/src/ustar.c +++ b/src/ustar.c @@ -351,6 +351,19 @@ opkg_opk_ustar_write_data(struct opkg_opk_ustar *ustar, size_t size) return OPKG_OPK_OK; } +int +opkg_opk_ustar_write_trailer(struct opkg_opk_ustar *ustar) +{ + memset(ustar->record, 0, OPKG_OPK_USTAR_RECORD_SIZE); + if (opkg_opk_gzip_write(ustar->gzip, ustar->record, + OPKG_OPK_USTAR_RECORD_SIZE, 0) != OPKG_OPK_OK || + opkg_opk_gzip_write(ustar->gzip, ustar->record, + OPKG_OPK_USTAR_RECORD_SIZE, 0) != OPKG_OPK_OK) { + return OPKG_OPK_ERROR; + } + return OPKG_OPK_OK; +} + void opkg_opk_ustar_free(struct opkg_opk_ustar *ustar) { diff --git a/src/ustar.h b/src/ustar.h index 4f6b79b..679f8ae 100644 --- a/src/ustar.h +++ b/src/ustar.h @@ -99,6 +99,9 @@ opkg_opk_ustar_get_buffer(struct opkg_opk_ustar *ustar, char **buffer, int opkg_opk_ustar_write_data(struct opkg_opk_ustar *ustar, size_t size); +int +opkg_opk_ustar_write_trailer(struct opkg_opk_ustar *ustar); + /* * Frees an archive structure. * Parameters: |