Blob Blame History Raw
diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index 9f0f941..9683100 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -181,7 +181,8 @@ static int db_fini(dbiIndex dbi, const char * dbhome,
 	xx = db_env_create(&dbenv, 0);
 	xx = cvtdberr(dbi, "db_env_create", xx, _debug);
 	xx = dbenv->remove(dbenv, dbhome, 0);
-	xx = cvtdberr(dbi, "dbenv->remove", xx, _debug);
+	/* filter out EBUSY as it just means somebody else gets to clean it */
+	xx = cvtdberr(dbi, "dbenv->remove", xx, (xx == EBUSY ? 0 : _debug));
 
 	if (dbfile)
 	    rpmlog(RPMLOG_DEBUG, "removed  db environment %s/%s\n",
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
index 0754b99..b781cfc 100644
--- a/lib/rpmdb.c
+++ b/lib/rpmdb.c
@@ -921,7 +921,8 @@ rpmdb newRpmdb(const char * root,
 	return NULL;
     }
     db->db_errpfx = rpmExpand( (epfx && *epfx ? epfx : _DB_ERRPFX), NULL);
-    db->db_remove_env = 0;
+    /* XXX remove environment after chrooted operations, for now... */
+    db->db_remove_env = ((strcmp(db->db_root, "/") != 0)? 1 : 0);
     db->db_filter_dups = _db_filter_dups;
     db->db_ndbi = dbiTags.max;
     db->_dbi = xcalloc(db->db_ndbi, sizeof(*db->_dbi));