summaryrefslogtreecommitdiff
path: root/lib/libalpm/add.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-08-14 10:14:35 -0400
committerDan McGee <dan@archlinux.org>2007-08-14 10:14:35 -0400
commita65ad4efc1102449a087b464d3b8d4670a614b99 (patch)
tree3131b4392641667c5d289d87eaccca976244aee1 /lib/libalpm/add.c
parent49c29e16b31ce35e81be210bc74a3834530bb9e0 (diff)
downloadpacman-a65ad4efc1102449a087b464d3b8d4670a614b99.tar.xz
package.h: implement origin_data union in pmpkg_t struct
We were using a void *data element in pmpkg_t before, which is unsafe by its nature of being untyped. Reimplement data as origin_data being a union that can hold either a path to a package file or a pointer to a cache database, and make the other necesary updates in the code to reflect this. See package.h for details. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r--lib/libalpm/add.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index e5323042..e9a4d7b7 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -738,7 +738,8 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
/* pre_upgrade scriptlet */
if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
- _alpm_runscriptlet(handle->root, newpkg->data, "pre_upgrade", newpkg->version, oldpkg->version, trans);
+ _alpm_runscriptlet(handle->root, newpkg->origin_data.file,
+ "pre_upgrade", newpkg->version, oldpkg->version, trans);
}
} else {
is_upgrade = 0;
@@ -749,7 +750,8 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
/* pre_install scriptlet */
if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
- _alpm_runscriptlet(handle->root, newpkg->data, "pre_install", newpkg->version, NULL, trans);
+ _alpm_runscriptlet(handle->root, newpkg->origin_data.file,
+ "pre_install", newpkg->version, NULL, trans);
}
}
@@ -771,7 +773,8 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
archive_read_support_compression_all(archive);
archive_read_support_format_all(archive);
- if(archive_read_open_file(archive, newpkg->data, ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
+ if(archive_read_open_filename(archive, newpkg->origin_data.file,
+ ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
RET_ERR(PM_ERR_PKG_OPEN, -1);
}