diff options
author | Dan McGee <dan@archlinux.org> | 2011-09-28 04:43:23 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-09-30 10:55:58 -0500 |
commit | 39b0ac43fcbe35897f616a8e202ae9f3bcb1ee5c (patch) | |
tree | e390376bfdc7818a7f5a21a3797be2cc951d7de8 /lib/libalpm/add.c | |
parent | 73139ccb3c47ed1ebb1a62a27deb080b66d92bf4 (diff) | |
download | pacman-39b0ac43fcbe35897f616a8e202ae9f3bcb1ee5c.tar.xz |
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 <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r-- | lib/libalpm/add.c | 8 |
1 files changed, 3 insertions, 5 deletions
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) { |