diff options
author | Timo Teräs <timo.teras@iki.fi> | 2021-12-03 14:52:07 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2021-12-03 14:53:30 +0200 |
commit | 1ab81fdd4cb9b88dad35cc93521650f85837fd6e (patch) | |
tree | e446d4db5c60e1dddca717d19030880428cbc5ef /src/package.c | |
parent | 4dde7e7e0fc79708119644b14b7123213d0de10d (diff) | |
download | apk-tools-1ab81fdd4cb9b88dad35cc93521650f85837fd6e.tar.gz apk-tools-1ab81fdd4cb9b88dad35cc93521650f85837fd6e.tar.bz2 apk-tools-1ab81fdd4cb9b88dad35cc93521650f85837fd6e.tar.xz apk-tools-1ab81fdd4cb9b88dad35cc93521650f85837fd6e.zip |
db: convert v3 scripts to ipkg on install
fixes #10796
Diffstat (limited to 'src/package.c')
-rw-r--r-- | src/package.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/package.c b/src/package.c index 0ad0156..6003c5b 100644 --- a/src/package.c +++ b/src/package.c @@ -738,20 +738,25 @@ void apk_pkg_free(struct apk_package *pkg) free(pkg); } -int apk_ipkg_add_script(struct apk_installed_package *ipkg, - struct apk_istream *is, - unsigned int type, unsigned int size) +int apk_ipkg_assign_script(struct apk_installed_package *ipkg, unsigned int type, apk_blob_t b) { - apk_blob_t b; - - if (type >= APK_SCRIPT_MAX) return -1; - b = apk_blob_from_istream(is, size); if (APK_BLOB_IS_NULL(b)) return -1; + if (type >= APK_SCRIPT_MAX) { + free(b.ptr); + return -1; + } if (ipkg->script[type].ptr) free(ipkg->script[type].ptr); ipkg->script[type] = b; return 0; } +int apk_ipkg_add_script(struct apk_installed_package *ipkg, + struct apk_istream *is, + unsigned int type, unsigned int size) +{ + return apk_ipkg_assign_script(ipkg, type, apk_blob_from_istream(is, size)); +} + void apk_ipkg_run_script(struct apk_installed_package *ipkg, struct apk_database *db, unsigned int type, char **argv) |