Silence error callback during from BDB during environment open
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 2 Mar 2011 06:28:35 +0000 (08:28 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 2 Mar 2011 06:32:18 +0000 (08:32 +0200)
- EACCES from actually opening the environment is returned only
  through dbenv->open() return code, but annoyingly the EACCESS
  from trying to create a missing environment is "leaked" to the
  errcall, causing pesky "permission denied" errors for regular users
  if the environment doesn't (yet) exist. Enable errcall in time
  for dbenv->failchk() though to get all the details if something
  goes wrong there.

lib/backend/db3.c

index 8496bea..ff55791 100644 (file)
@@ -141,7 +141,7 @@ static int db_init(rpmdb rdb, const char * dbhome)
        goto errxit;
 
     dbenv->set_alloc(dbenv, rmalloc, rrealloc, NULL);
-    dbenv->set_errcall(dbenv, errlog);
+    dbenv->set_errcall(dbenv, NULL);
     dbenv->set_errpfx(dbenv, _errpfx);
 
     /* 
@@ -189,6 +189,8 @@ static int db_init(rpmdb rdb, const char * dbhome)
     if (rc)
        goto errxit;
 
+    dbenv->set_errcall(dbenv, errlog);
+
     /* stale lock removal */
     rc = dbenv->failchk(dbenv, 0);
     rc = dbapi_err(rdb, "dbenv->failchk", rc, _debug);