From 39b0ac43fcbe35897f616a8e202ae9f3bcb1ee5c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 28 Sep 2011 04:43:23 -0500 Subject: Revamp scriptlet path formation for scriptlets in local database Expose the current static get_pkgpath() function internally to the rest of the library as _alpm_local_db_pkgpath(). This allows use of this convenience function in add.c and remove.c when forming the path to the scriptlet location. Signed-off-by: Dan McGee --- lib/libalpm/add.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/libalpm/add.c') diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 33b85c0b..653d2bd9 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -650,14 +650,12 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, /* run the post-install script if it exists */ if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) { - char scriptlet[PATH_MAX]; - const char *scriptlet_name; - snprintf(scriptlet, PATH_MAX, "%s%s-%s/install", - _alpm_db_path(db), newpkg->name, newpkg->version); - scriptlet_name = is_upgrade ? "post_upgrade" : "post_install"; + char *scriptlet = _alpm_local_db_pkgpath(db, newpkg, "install"); + const char *scriptlet_name = is_upgrade ? "post_upgrade" : "post_install"; _alpm_runscriptlet(handle, scriptlet, scriptlet_name, newpkg->version, oldpkg ? oldpkg->version : NULL, 0); + free(scriptlet); } if(is_upgrade) { -- cgit v1.2.3-24-g4f1b