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:
parent
351942c71b
commit
e68e994eb2
@ -77,10 +77,19 @@ int SYMEXPORT alpm_initialize(void)
|
|||||||
*/
|
*/
|
||||||
int SYMEXPORT alpm_release(void)
|
int SYMEXPORT alpm_release(void)
|
||||||
{
|
{
|
||||||
|
pmdb_t *db;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
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) {
|
if(alpm_db_unregister_all() == -1) {
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
@ -90,12 +90,8 @@ int SYMEXPORT alpm_db_unregister_all(void)
|
|||||||
/* Do not unregister a database if a transaction is on-going */
|
/* Do not unregister a database if a transaction is on-going */
|
||||||
ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, -1));
|
ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, -1));
|
||||||
|
|
||||||
/* close local database */
|
/* since the local DB is registered in alpm_initialize(), we'll be
|
||||||
db = handle->db_local;
|
* symmetrical and let the cleanup occur in alpm_release() */
|
||||||
if(db) {
|
|
||||||
db->ops->unregister(db);
|
|
||||||
handle->db_local = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* and also sync ones */
|
/* and also sync ones */
|
||||||
for(i = handle->dbs_sync; i; i = i->next) {
|
for(i = handle->dbs_sync; i; i = i->next) {
|
||||||
|
Loading…
Reference in New Issue
Block a user