From 871e123cf3fafe5aff734e2c5cf1ce89a203f719 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Thu, 22 Feb 2007 04:42:59 +0000 Subject: * Cleaned up some debug output * Fixed a segfault in the conflict checking code * Added an automatic failure in the case of -A/-U for a replacement of an existing package. This requires a large amount of work and is postponed for now. Example: If ncmpc is installed, pacman -U /path/to/ncmpc-svn.pkg.tar.gz will fail with and appropriate error message --- lib/libalpm/cache.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/cache.c') diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c index 456c98bd..e3df2fd2 100644 --- a/lib/libalpm/cache.c +++ b/lib/libalpm/cache.c @@ -61,7 +61,7 @@ int _alpm_db_load_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel) _alpm_db_rewind(db); while((info = _alpm_db_scan(db, NULL, infolevel)) != NULL) { - _alpm_log(PM_LOG_DEBUG, _("adding '%s' to package cache for db '%s'"), info->name, db->treename); + _alpm_log(PM_LOG_FUNCTION, _("adding '%s' to package cache for db '%s'"), info->name, db->treename); info->origin = PKG_FROM_CACHE; info->data = db; /* add to the collection */ @@ -195,7 +195,13 @@ pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, char *target) return(NULL); } - return(_alpm_pkg_isin(target, _alpm_db_get_pkgcache(db, INFRQ_NONE))); + alpm_list_t *pkgcache = _alpm_db_get_pkgcache(db, INFRQ_NONE); + if(!pkgcache) { + _alpm_log(PM_LOG_DEBUG, _("error: pkgcache is NULL for db '%s'"), db->treename); + return(NULL); + } + + return(_alpm_pkg_isin(target, pkgcache)); } /* Returns a new group cache from db. -- cgit v1.2.3-54-g00ecf