summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-08-13 19:21:31 +0300
committerTimo Teras <timo.teras@iki.fi>2009-08-13 19:21:31 +0300
commite20ce5a9c03e32fcb773c13072f903fb6a30fda5 (patch)
treebc606b4ef4e237351f55739d352a947f96ec7461
parent6c96730cdf86f900bc74429dc35b6edb4bcaa784 (diff)
downloadapk-tools-e20ce5a9c03e32fcb773c13072f903fb6a30fda5.tar.bz2
apk-tools-e20ce5a9c03e32fcb773c13072f903fb6a30fda5.tar.xz
db: fix script arguments
the first item is place holder for argv[0] = script name. it's overwritten by the apk_pkgi_run_script.
-rw-r--r--src/database.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/database.c b/src/database.c
index d685415..df6e7f0 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1230,6 +1230,10 @@ static int fire_triggers(apk_hash_item item, void *ctx)
FNM_PATHNAME) != 0)
continue;
+ if (ipkg->pending_triggers == NULL)
+ *apk_string_array_add(&ipkg->pending_triggers) =
+ NULL;
+
*apk_string_array_add(&ipkg->pending_triggers) =
dbd->rooted_name;
break;
@@ -2000,16 +2004,16 @@ int apk_db_install_pkg(struct apk_database *db,
struct apk_package *newpkg,
apk_progress_cb cb, void *cb_ctx)
{
- char *script_args[] = { NULL, NULL, NULL };
+ char *script_args[] = { NULL, NULL, NULL, NULL };
struct apk_installed_package *ipkg;
int r;
/* Upgrade script gets two args: <new-pkg> <old-pkg> */
if (oldpkg != NULL && newpkg != NULL) {
- script_args[0] = newpkg->version;
- script_args[1] = oldpkg->version;
+ script_args[1] = newpkg->version;
+ script_args[2] = oldpkg->version;
} else {
- script_args[0] = oldpkg ? oldpkg->version : newpkg->version;
+ script_args[1] = oldpkg ? oldpkg->version : newpkg->version;
}
/* Just purging? */