commit 0ee494ea672b9125171098184c702ccc3dd0163e
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Fri Jan 21 15:20:01 2011 +0200
Don't try to remove existing environment when using private environment
(cherry picked from commit 88e63b050cfd3ba28cb44e75b3ac31fdf5fe9909)
diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index 365cd13..da1b602 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -51,6 +51,7 @@ static int db_fini(rpmdb rdb, const char * dbhome)
{
DB_ENV * dbenv = rdb->db_dbenv;
int rc;
+ uint32_t eflags = 0;
if (dbenv == NULL)
return 0;
@@ -60,12 +61,13 @@ static int db_fini(rpmdb rdb, const char * dbhome)
return 0;
}
+ (void) dbenv->get_open_flags(dbenv, &eflags);
rc = dbenv->close(dbenv, 0);
rc = dbapi_err(rdb, "dbenv->close", rc, _debug);
rpmlog(RPMLOG_DEBUG, "closed db environment %s\n", dbhome);
- if (rdb->db_remove_env) {
+ if (!(eflags & DB_PRIVATE) && rdb->db_remove_env) {
int xx;
xx = db_env_create(&dbenv, 0);