Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/add.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-10-27 14:59:24 -0500
committerDan McGee <dan@archlinux.org>2011-10-27 14:59:24 -0500
commit3343185473c79d556b29bda30c9c482c7fef5289 (patch)
treeaedd3febc30983236bde017ac7a610bf7ede5516 /lib/libalpm/add.c
parent1052709921da50ec5203efaa313dbda75625a4e1 (diff)
Introduce ALPM_BUFFER_SIZE constant
This takes the place of three previously used constants: ARCHIVE_DEFAULT_BYTES_PER_BLOCK, BUFFER_SIZE, and CPBUFSIZE. In libarchive 3.0, the first constant will be no more, so we can ensure we are forward-compatible by removing our usage of it now. The rest are unified for consistency. By default, we will use the value of BUFSIZ provided by <stdio.h>, which is 8192 on Linux. If that is undefined, a default value is provided. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r--lib/libalpm/add.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 653d2bd9..6c2f0cb6 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -456,6 +456,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
alpm_pkg_t *oldpkg = NULL;
alpm_db_t *db = handle->db_local;
alpm_trans_t *trans = handle->trans;
+ const char *pkgfile;
ASSERT(trans != NULL, return -1);
@@ -479,13 +480,15 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
EVENT(handle, ALPM_EVENT_ADD_START, newpkg, NULL);
}
+ pkgfile = newpkg->origin_data.file;
+
_alpm_log(handle, ALPM_LOG_DEBUG, "%s package %s-%s\n",
is_upgrade ? "upgrading" : "adding", newpkg->name, newpkg->version);
/* pre_install/pre_upgrade scriptlet */
if(alpm_pkg_has_scriptlet(newpkg) &&
!(trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
const char *scriptlet_name = is_upgrade ? "pre_upgrade" : "pre_install";
- _alpm_runscriptlet(handle, newpkg->origin_data.file,
+ _alpm_runscriptlet(handle, pkgfile,
scriptlet_name, newpkg->version, NULL, 1);
}
@@ -531,9 +534,9 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
archive_read_support_compression_all(archive);
archive_read_support_format_all(archive);
- _alpm_log(handle, ALPM_LOG_DEBUG, "archive: %s\n", newpkg->origin_data.file);
- if(archive_read_open_filename(archive, newpkg->origin_data.file,
- ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
+ _alpm_log(handle, ALPM_LOG_DEBUG, "archive: %s\n", pkgfile);
+ if(archive_read_open_filename(archive, pkgfile,
+ ALPM_BUFFER_SIZE) != ARCHIVE_OK) {
handle->pm_errno = ALPM_ERR_PKG_OPEN;
ret = -1;
goto cleanup;