1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

alpm/db: do not close local DB in alpm_db_unregister_all

pacman 3.5.0 removed alpm_db_register_local, so calling
alpm_db_unregister_all leaves the front end in a position where there's
no local db, and no way to re-register it.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dave Reisner 2011-03-24 15:10:01 -04:00 committed by Dan McGee
parent 351942c71b
commit e68e994eb2
2 changed files with 11 additions and 6 deletions

View File

@ -77,10 +77,19 @@ int SYMEXPORT alpm_initialize(void)
*/
int SYMEXPORT alpm_release(void)
{
pmdb_t *db;
ALPM_LOG_FUNC;
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
/* close local database */
db = handle->db_local;
if(db) {
db->ops->unregister(db);
handle->db_local = NULL;
}
if(alpm_db_unregister_all() == -1) {
return(-1);
}

View File

@ -90,12 +90,8 @@ int SYMEXPORT alpm_db_unregister_all(void)
/* Do not unregister a database if a transaction is on-going */
ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, -1));
/* close local database */
db = handle->db_local;
if(db) {
db->ops->unregister(db);
handle->db_local = NULL;
}
/* since the local DB is registered in alpm_initialize(), we'll be
* symmetrical and let the cleanup occur in alpm_release() */
/* and also sync ones */
for(i = handle->dbs_sync; i; i = i->next) {