[pacman-dev] [PATCH 1/7] Search for non-prefixed paths in skip_remove list
We add them to this list with the root path not appended; we should be searching for them this way as well. Signed-off-by: Dan McGee <dan@archlinux.org> --- lib/libalpm/remove.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 8021702..c6a3efc 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -216,12 +216,12 @@ static int can_remove_file(alpm_handle_t *handle, const alpm_file_t *file, { char filepath[PATH_MAX]; - snprintf(filepath, PATH_MAX, "%s%s", handle->root, file->name); - - if(alpm_list_find_str(skip_remove, filepath)) { + if(alpm_list_find_str(skip_remove, file->name)) { /* return success because we will never actually remove this file */ return 1; } + + snprintf(filepath, PATH_MAX, "%s%s", handle->root, file->name); /* If we fail write permissions due to a read-only filesystem, abort. * Assume all other possible failures are covered somewhere else */ if(_alpm_access(handle, NULL, filepath, W_OK) == -1) { -- 1.7.6.1
1. Don't run it if something failed in package removal- this mirrors what we already do in sync transactions. 2. Don't run it if we are invoking it for the replaces removal bit of a sync transaction- it doesn't make sense to run ldconfig halfway through a sync install; we should only run it once at the end. Signed-off-by: Dan McGee <dan@archlinux.org> --- lib/libalpm/remove.c | 14 ++++++++------ lib/libalpm/remove.h | 2 +- lib/libalpm/sync.c | 2 +- lib/libalpm/trans.c | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index c6a3efc..e998763 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -475,7 +475,7 @@ db: return 0; } -int _alpm_remove_packages(alpm_handle_t *handle) +int _alpm_remove_packages(alpm_handle_t *handle, int run_ldconfig) { alpm_list_t *targ; size_t pkg_count, targ_count; @@ -489,23 +489,25 @@ int _alpm_remove_packages(alpm_handle_t *handle) alpm_pkg_t *pkg = targ->data; if(trans->state == STATE_INTERRUPTED) { - return 0; + return ret; } if(_alpm_remove_single_package(handle, pkg, NULL, targ_count, pkg_count) == -1) { handle->pm_errno = ALPM_ERR_TRANS_ABORT; + /* running ldconfig at this point could possibly screw system */ + run_ldconfig = 0; ret = -1; - goto cleanup; } targ_count++; } - /* run ldconfig if it exists */ - _alpm_ldconfig(handle); + if(run_ldconfig) { + /* run ldconfig if it exists */ + _alpm_ldconfig(handle); + } -cleanup: return ret; } diff --git a/lib/libalpm/remove.h b/lib/libalpm/remove.h index 5da645b..251e454 100644 --- a/lib/libalpm/remove.h +++ b/lib/libalpm/remove.h @@ -25,7 +25,7 @@ #include "trans.h" int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data); -int _alpm_remove_packages(alpm_handle_t *handle); +int _alpm_remove_packages(alpm_handle_t *handle, int run_ldconfig); int _alpm_remove_single_package(alpm_handle_t *handle, alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg, diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 717ba7c..c6a79fa 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -1042,7 +1042,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) if(replaces) { _alpm_log(handle, ALPM_LOG_DEBUG, "removing conflicting and to-be-replaced packages\n"); /* we want the frontend to be aware of commit details */ - if(_alpm_remove_packages(handle) == -1) { + if(_alpm_remove_packages(handle, 0) == -1) { _alpm_log(handle, ALPM_LOG_ERROR, _("could not commit removal transaction\n")); return -1; } diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 47b9c98..a4716b8 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -164,7 +164,7 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data) trans->state = STATE_COMMITING; if(trans->add == NULL) { - if(_alpm_remove_packages(handle) == -1) { + if(_alpm_remove_packages(handle, 1) == -1) { /* pm_errno is set by _alpm_remove_commit() */ return -1; } -- 1.7.6.1
We did a lot of both malloc-ing and stack printing to form some paths in this code. Attempt to unify it all into the one get_pkgpath() method by adding an optional third "filename" parameter, and form the necessary path string all in one go. Signed-off-by: Dan McGee <dan@archlinux.org> --- lib/libalpm/be_local.c | 67 +++++++++++++++++++++++++----------------------- 1 files changed, 35 insertions(+), 32 deletions(-) diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 1b828d9..109aaaf 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -475,7 +475,7 @@ static int local_db_populate(alpm_db_t *db) } /* Note: the return value must be freed by the caller */ -static char *get_pkgpath(alpm_db_t *db, alpm_pkg_t *info) +static char *get_pkgpath(alpm_db_t *db, alpm_pkg_t *info, const char *filename) { size_t len; char *pkgpath; @@ -483,8 +483,10 @@ static char *get_pkgpath(alpm_db_t *db, alpm_pkg_t *info) dbpath = _alpm_db_path(db); len = strlen(dbpath) + strlen(info->name) + strlen(info->version) + 3; + len += filename ? strlen(filename) : 0; MALLOC(pkgpath, len, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL)); - sprintf(pkgpath, "%s%s-%s/", dbpath, info->name, info->version); + sprintf(pkgpath, "%s%s-%s/%s", dbpath, info->name, info->version, + filename ? filename : ""); return pkgpath; } @@ -519,9 +521,8 @@ static char *get_pkgpath(alpm_db_t *db, alpm_pkg_t *info) static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq) { FILE *fp = NULL; - char path[PATH_MAX]; char line[1024]; - char *pkgpath = NULL; + char *pkgpath; alpm_db_t *db = info->origin_data.db; /* bitmask logic here: @@ -543,25 +544,27 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq) _alpm_log(db->handle, ALPM_LOG_FUNCTION, "loading package data for %s : level=0x%x\n", info->name, inforeq); - /* clear out 'line', to be certain - and to make valgrind happy */ - memset(line, 0, sizeof(line)); - - pkgpath = get_pkgpath(db, info); - - if(access(pkgpath, F_OK)) { + pkgpath = get_pkgpath(db, info, NULL); + if(!pkgpath || access(pkgpath, F_OK)) { /* directory doesn't exist or can't be opened */ _alpm_log(db->handle, ALPM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'\n", info->name, info->version, db->treename); goto error; } + free(pkgpath); + + /* clear out 'line', to be certain - and to make valgrind happy */ + memset(line, 0, sizeof(line)); /* DESC */ if(inforeq & INFRQ_DESC && !(info->infolevel & INFRQ_DESC)) { - snprintf(path, PATH_MAX, "%sdesc", pkgpath); - if((fp = fopen(path, "r")) == NULL) { + char *path = get_pkgpath(db, info, "desc"); + if(!path || (fp = fopen(path, "r")) == NULL) { _alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno)); + free(path); goto error; } + free(path); while(!feof(fp)) { if(fgets(line, sizeof(line), fp) == NULL && !feof(fp)) { goto error; @@ -625,11 +628,13 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq) /* FILES */ if(inforeq & INFRQ_FILES && !(info->infolevel & INFRQ_FILES)) { - snprintf(path, PATH_MAX, "%sfiles", pkgpath); - if((fp = fopen(path, "r")) == NULL) { + char *path = get_pkgpath(db, info, "files"); + if(!path || (fp = fopen(path, "r")) == NULL) { _alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno)); + free(path); goto error; } + free(path); while(fgets(line, sizeof(line), fp)) { _alpm_strip_newline(line); if(strcmp(line, "%FILES%") == 0) { @@ -680,19 +685,18 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq) /* INSTALL */ if(inforeq & INFRQ_SCRIPTLET && !(info->infolevel & INFRQ_SCRIPTLET)) { - snprintf(path, PATH_MAX, "%sinstall", pkgpath); + char *path = get_pkgpath(db, info, "install"); if(access(path, F_OK) == 0) { info->scriptlet = 1; } + free(path); info->infolevel |= INFRQ_SCRIPTLET; } - free(pkgpath); return 0; error: info->infolevel |= INFRQ_ERROR; - free(pkgpath); if(fp) { fclose(fp); } @@ -703,14 +707,14 @@ int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info) { mode_t oldmask; int retval = 0; - char *pkgpath = NULL; + char *pkgpath; if(checkdbdir(db) != 0) { return -1; } oldmask = umask(0000); - pkgpath = get_pkgpath(db, info); + pkgpath = get_pkgpath(db, info, NULL); if((retval = mkdir(pkgpath, 0755)) != 0) { _alpm_log(db->handle, ALPM_LOG_ERROR, _("could not create directory %s: %s\n"), @@ -726,32 +730,31 @@ int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info) int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq) { FILE *fp = NULL; - char path[PATH_MAX]; mode_t oldmask; - alpm_list_t *lp = NULL; + alpm_list_t *lp; int retval = 0; - char *pkgpath = NULL; if(db == NULL || info == NULL || !(db->status & DB_STATUS_LOCAL)) { return -1; } - pkgpath = get_pkgpath(db, info); - /* make sure we have a sane umask */ oldmask = umask(0022); /* DESC */ if(inforeq & INFRQ_DESC) { + char *path; _alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s DESC information back to db\n", info->name, info->version); - snprintf(path, PATH_MAX, "%sdesc", pkgpath); - if((fp = fopen(path, "w")) == NULL) { + path = get_pkgpath(db, info, "desc"); + if(!path || (fp = fopen(path, "w")) == NULL) { _alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno)); retval = -1; + free(path); goto cleanup; } + free(path); fprintf(fp, "%%NAME%%\n%s\n\n" "%%VERSION%%\n%s\n\n", info->name, info->version); if(info->desc) { @@ -851,15 +854,18 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq /* FILES */ if(inforeq & INFRQ_FILES) { + char *path; _alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s FILES information back to db\n", info->name, info->version); - snprintf(path, PATH_MAX, "%sfiles", pkgpath); - if((fp = fopen(path, "w")) == NULL) { + path = get_pkgpath(db, info, "files"); + if(!path || (fp = fopen(path, "w")) == NULL) { _alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno)); retval = -1; + free(path); goto cleanup; } + free(path); if(info->files.count) { size_t i; fprintf(fp, "%%FILES%%\n"); @@ -886,7 +892,6 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq cleanup: umask(oldmask); - free(pkgpath); if(fp) { fclose(fp); @@ -898,9 +903,7 @@ cleanup: int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info) { int ret = 0; - char *pkgpath = NULL; - - pkgpath = get_pkgpath(db, info); + char *pkgpath = get_pkgpath(db, info, NULL); ret = _alpm_rmrf(pkgpath); free(pkgpath); -- 1.7.6.1
Rather than using a string-based path, we can restore the working directory via a file descriptor and use of fchdir().
From the getcwd manpage: Opening the current directory (".") and calling fchdir(2) to return is usually a faster and more reliable alternative when sufficiently many file descriptors are available.
Signed-off-by: Dan McGee <dan@archlinux.org> --- lib/libalpm/add.c | 19 ++++++++++++------- lib/libalpm/handle.c | 2 +- lib/libalpm/util.c | 40 ++++++++++++++++++++++++---------------- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index b526145..eb05f84 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -25,6 +25,7 @@ #include <time.h> #include <string.h> #include <limits.h> +#include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> @@ -528,8 +529,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, if(!(trans->flags & ALPM_TRANS_FLAG_DBONLY)) { struct archive *archive; struct archive_entry *entry; - char cwd[PATH_MAX] = ""; - int restore_cwd = 0; + int cwdfd; _alpm_log(handle, ALPM_LOG_DEBUG, "extracting files\n"); @@ -551,10 +551,11 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, } /* save the cwd so we can restore it later */ - if(getcwd(cwd, PATH_MAX) == NULL) { + do { + cwdfd = open(".", O_RDONLY); + } while(cwdfd == -1 && errno == EINTR); + if(cwdfd < 0) { _alpm_log(handle, ALPM_LOG_ERROR, _("could not get current working directory\n")); - } else { - restore_cwd = 1; } /* libarchive requires this for extracting hard links */ @@ -607,8 +608,12 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, archive_read_finish(archive); /* restore the old cwd if we have it */ - if(restore_cwd && chdir(cwd) != 0) { - _alpm_log(handle, ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"), cwd, strerror(errno)); + if(cwdfd >= 0) { + if(fchdir(cwdfd) != 0) { + _alpm_log(handle, ALPM_LOG_ERROR, + _("could not restore working directory (%s)\n"), strerror(errno)); + } + close(cwdfd); } if(errors) { diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 5fb4f2b..dcd81ce 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -115,7 +115,7 @@ int _alpm_handle_lock(alpm_handle_t *handle) do { fd = open(handle->lockfile, O_WRONLY | O_CREAT | O_EXCL, 0000); } while(fd == -1 && errno == EINTR); - if(fd > 0) { + if(fd >= 0) { FILE *f = fdopen(fd, "w"); fprintf(f, "%ld\n", (long)getpid()); fflush(f); diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index f4fecab..e2f2f44 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -31,6 +31,7 @@ #include <unistd.h> #include <ctype.h> #include <dirent.h> +#include <fcntl.h> #include <time.h> #include <syslog.h> #include <errno.h> @@ -277,8 +278,7 @@ int _alpm_unpack(alpm_handle_t *handle, const char *archive, const char *prefix, mode_t oldmask; struct archive *_archive; struct archive_entry *entry; - char cwd[PATH_MAX]; - int restore_cwd = 0; + int cwdfd; if((_archive = archive_read_new()) == NULL) { RET_ERR(handle, ALPM_ERR_LIBARCHIVE, 1); @@ -297,10 +297,11 @@ int _alpm_unpack(alpm_handle_t *handle, const char *archive, const char *prefix, oldmask = umask(0022); /* save the cwd so we can restore it later */ - if(getcwd(cwd, PATH_MAX) == NULL) { + do { + cwdfd = open(".", O_RDONLY); + } while(cwdfd == -1 && errno == EINTR); + if(cwdfd < 0) { _alpm_log(handle, ALPM_LOG_ERROR, _("could not get current working directory\n")); - } else { - restore_cwd = 1; } /* just in case our cwd was removed in the upgrade operation */ @@ -365,10 +366,14 @@ int _alpm_unpack(alpm_handle_t *handle, const char *archive, const char *prefix, cleanup: umask(oldmask); archive_read_finish(_archive); - if(restore_cwd && chdir(cwd) != 0) { - _alpm_log(handle, ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"), - cwd, strerror(errno)); + if(cwdfd >= 0) { + if(fchdir(cwdfd) != 0) { + _alpm_log(handle, ALPM_LOG_ERROR, + _("could not restore working directory (%s)\n"), strerror(errno)); + } + close(cwdfd); } + return ret; } @@ -490,17 +495,16 @@ int _alpm_logaction(alpm_handle_t *handle, const char *fmt, va_list args) int _alpm_run_chroot(alpm_handle_t *handle, const char *path, char *const argv[]) { - char cwd[PATH_MAX]; pid_t pid; - int pipefd[2]; - int restore_cwd = 0; + int pipefd[2], cwdfd; int retval = 0; /* save the cwd so we can restore it later */ - if(getcwd(cwd, PATH_MAX) == NULL) { + do { + cwdfd = open(".", O_RDONLY); + } while(cwdfd == -1 && errno == EINTR); + if(cwdfd < 0) { _alpm_log(handle, ALPM_LOG_ERROR, _("could not get current working directory\n")); - } else { - restore_cwd = 1; } /* just in case our cwd was removed in the upgrade operation */ @@ -598,8 +602,12 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *path, char *const argv[] } cleanup: - if(restore_cwd && chdir(cwd) != 0) { - _alpm_log(handle, ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"), cwd, strerror(errno)); + if(cwdfd >= 0) { + if(fchdir(cwdfd) != 0) { + _alpm_log(handle, ALPM_LOG_ERROR, + _("could not restore working directory (%s)\n"), strerror(errno)); + } + close(cwdfd); } return retval; -- 1.7.6.1
We shouldn't be going through the accessor that does a bunch of unnecessary legwork, including potentially loading the pkgcache right before we free it. Signed-off-by: Dan McGee <dan@archlinux.org> --- lib/libalpm/db.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 765448d..7708d18 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -508,9 +508,11 @@ void _alpm_db_free_pkgcache(alpm_db_t *db) _alpm_log(db->handle, ALPM_LOG_DEBUG, "freeing package cache for repository '%s'\n", db->treename); - alpm_list_free_inner(_alpm_db_get_pkgcache(db), + if(db->pkgcache) { + alpm_list_free_inner(db->pkgcache->list, (alpm_list_fn_free)_alpm_pkg_free); - _alpm_pkghash_free(db->pkgcache); + _alpm_pkghash_free(db->pkgcache); + } db->status &= ~DB_STATUS_PKGCACHE; free_groupcache(db); -- 1.7.6.1
This is always true at the end since we return early if we couldn't create the tmpdir, so it is totally unnecessary. Signed-off-by: Dan McGee <dan@archlinux.org> --- lib/libalpm/trans.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index a4716b8..a5fa95b 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -280,7 +280,6 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn, char tmpdir[PATH_MAX]; char *argv[] = { "sh", "-c", cmdline, NULL }; char *scriptpath; - int clean_tmpdir = 0; int retval = 0; if(_alpm_access(handle, NULL, installfn, R_OK) != 0) { @@ -297,8 +296,6 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn, if(mkdtemp(tmpdir) == NULL) { _alpm_log(handle, ALPM_LOG_ERROR, _("could not create temp directory\n")); return 1; - } else { - clean_tmpdir = 1; } /* either extract or copy the scriptlet */ @@ -317,14 +314,14 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn, goto cleanup; } - /* chop off the root so we can find the tmpdir in the chroot */ - scriptpath = scriptfn + strlen(handle->root) - 1; - if(!grep(scriptfn, script)) { /* script not found in scriptlet file */ goto cleanup; } + /* chop off the root so we can find the tmpdir in the chroot */ + scriptpath = scriptfn + strlen(handle->root) - 1; + if(oldver) { snprintf(cmdline, PATH_MAX, ". %s; %s %s %s", scriptpath, script, ver, oldver); @@ -338,7 +335,7 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn, retval = _alpm_run_chroot(handle, "/bin/sh", argv); cleanup: - if(clean_tmpdir && _alpm_rmrf(tmpdir)) { + if(_alpm_rmrf(tmpdir)) { _alpm_log(handle, ALPM_LOG_WARNING, _("could not remove tmpdir %s\n"), tmpdir); } -- 1.7.6.1
No need for the indirection; just access ->data instead. Signed-off-by: Dan McGee <dan@archlinux.org> --- lib/libalpm/deps.c | 3 ++- lib/libalpm/package.c | 2 +- lib/libalpm/sync.c | 2 +- lib/libalpm/util.c | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 0da20c1..08494a6 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -644,7 +644,8 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep, providers, dep, NULL, &index); } if(index >= 0 && index < count) { - alpm_pkg_t *pkg = alpm_list_getdata(alpm_list_nth(providers, index)); + alpm_list_t *nth = alpm_list_nth(providers, index); + alpm_pkg_t *pkg = nth->data; alpm_list_free(providers); return pkg; } diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index ecea411..11bf01a 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -696,7 +696,7 @@ int _alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg) /* next see if the package is in a group that is ignored */ for(groups = handle->ignoregroup; groups; groups = groups->next) { - char *grp = (char *)alpm_list_getdata(groups); + char *grp = groups->data; if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) { return 1; } diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index c6a79fa..732e786 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -767,7 +767,7 @@ static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas, EVENT(handle, ALPM_EVENT_DELTA_INTEGRITY_START, NULL, NULL); for(i = deltas; i; i = i->next) { - alpm_delta_t *d = alpm_list_getdata(i); + alpm_delta_t *d = i->data; char *filepath = _alpm_filecache_find(handle, d->delta); if(_alpm_test_checksum(filepath, d->delta_md5, ALPM_CSUM_MD5)) { diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index e2f2f44..a15eb96 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -652,7 +652,7 @@ char *_alpm_filecache_find(alpm_handle_t *handle, const char *filename) /* Loop through the cache dirs until we find a matching file */ for(i = handle->cachedirs; i; i = i->next) { - snprintf(path, PATH_MAX, "%s%s", (char *)alpm_list_getdata(i), + snprintf(path, PATH_MAX, "%s%s", (char *)i->data, filename); if(stat(path, &buf) == 0 && S_ISREG(buf.st_mode)) { retpath = strdup(path); @@ -677,7 +677,7 @@ const char *_alpm_filecache_setup(alpm_handle_t *handle) /* Loop through the cache dirs until we find a usable directory */ for(i = handle->cachedirs; i; i = i->next) { - cachedir = alpm_list_getdata(i); + cachedir = i->data; if(stat(cachedir, &buf) != 0) { /* cache directory does not exist.... try creating it */ _alpm_log(handle, ALPM_LOG_WARNING, _("no %s cache exists, creating...\n"), -- 1.7.6.1
participants (1)
-
Dan McGee