Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-10-22 08:29:12 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-10-22 08:29:12 +0000
commit5d5d7d6339945e0f35e03740f275dbddfd72ae3d (patch)
treead0894d5888cb578397140352c06cedcc6748aa7 /lib
parentfa627d4776ae56197f2aead259c8b5e19d269586 (diff)
do not free the cache right before using it!
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/alpm.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 427c536b..4719c493 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -282,25 +282,21 @@ int alpm_db_update(PM_DB *db, char *archive, char *ts)
}
}
- if(stat(archive, &buf)) {
- /* not found */
- RET_ERR(PM_ERR_NOT_A_FILE, -1);
+ /* remove the old dir */
+ _alpm_log(PM_LOG_FLOW2, "flushing database %s/%s", handle->dbpath, db->treename);
+ for(lp = db_get_pkgcache(db); lp; lp = lp->next) {
+ if(db_remove(db, lp->data) == -1) {
+ if(lp->data) {
+ _alpm_log(PM_LOG_ERROR, "could not remove database entry %s/%s", db->treename,
+ ((pmpkg_t *)lp->data)->name);
+ }
+ RET_ERR(PM_ERR_XXX, -1);
+ }
}
/* Cache needs to be rebuild */
db_free_pkgcache(db);
- /* remove the old dir */
- _alpm_log(PM_LOG_FLOW2, "removing database %s/%s", handle->dbpath, db->treename);
- for(lp = alpm_db_getpkgcache(db); lp; lp = alpm_list_next(lp)) {
- db_remove(db, alpm_list_getdata(lp));
- }
-
- /* make the new dir */
- if(db_create(handle->root, handle->dbpath, db->treename) != 0) {
- RET_ERR(PM_ERR_DB_CREATE, -1);
- }
-
/* uncompress the sync database */
/* ORE
we should not simply unpack the archive, but better parse it and