diff options
author | Aaron Griffin <aaron@archlinux.org> | 2006-11-08 07:52:50 +0100 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2006-11-08 07:52:50 +0100 |
commit | 55f178c629ada663d2a8e5bbed029ec9482f00ea (patch) | |
tree | fbd271d7ef2d8c97df1727c02f6ab9b2508813ec | |
parent | 34931106d7653e73bb474e1d72aee4044f7d5a5d (diff) | |
download | pacman-55f178c629ada663d2a8e5bbed029ec9482f00ea.tar.gz pacman-55f178c629ada663d2a8e5bbed029ec9482f00ea.tar.xz |
* Fixed an error message that should be a debug message
* Fixed "the big segfault" - dbs_sync list was being modified while iterating
* over the list, big No-No. Now using a while loop over alpm_list_count.
-rw-r--r-- | lib/libalpm/alpm.c | 10 | ||||
-rw-r--r-- | lib/libalpm/be_files.c | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index d360fa65..9f6271f1 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -100,7 +100,7 @@ int alpm_initialize(char *root) */ int alpm_release() { - pmlist_t *i; + int dbs_left = 0; ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); @@ -115,9 +115,11 @@ int alpm_release() handle->db_local = NULL; } /* and also sync ones */ - for(i = handle->dbs_sync; i; i = i->next) { - alpm_db_unregister(i->data); - i->data = NULL; + while((dbs_left = alpm_list_count(handle->dbs_sync)) > 0) { + pmdb_t *db = (pmdb_t *)handle->dbs_sync->data; + _alpm_log(PM_LOG_DEBUG, _("removing DB %s, %d remaining..."), db->treename, dbs_left); + alpm_db_unregister(db); + db = NULL; } FREEHANDLE(handle); diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index 35a1e981..f90f6979 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -189,7 +189,7 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info) } if(info == NULL || info->name[0] == 0 || info->version[0] == 0) { - _alpm_log(PM_LOG_ERROR, _("invalid package entry provided to _alpm_db_read")); + _alpm_log(PM_LOG_DEBUG, _("invalid package entry provided to _alpm_db_read, skipping")); return(-1); } |