#include "debug.h"
+static const char * _errpfx = "rpmdb";
+
static int cvtdberr(dbiIndex dbi, const char * msg, int error, int printit)
{
if (printit && error) {
dbenv->set_alloc(dbenv, rmalloc, rrealloc, NULL);
dbenv->set_errcall(dbenv, NULL);
- dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
+ dbenv->set_errpfx(dbenv, _errpfx);
#if (DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 5)
/*
if (rc || dbenv == NULL) goto exit;
dbenv->set_errcall(dbenv, NULL);
- dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
+ dbenv->set_errpfx(dbenv, _errpfx);
#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
xx = dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT,
(dbi->dbi_verbose & DB_VERB_CHKPOINT));
#define _DB_PERMS 0644
#define _DB_MAJOR -1
-#define _DB_ERRPFX "rpmdb"
static struct rpmdb_s const dbTemplate = {
_DB_ROOT, _DB_HOME, _DB_FULLPATH, _DB_FLAGS, _DB_MODE, _DB_PERMS,
- _DB_MAJOR, _DB_ERRPFX
+ _DB_MAJOR,
};
rpmop rpmdbOp(rpmdb rpmdb, rpmdbOpX opx)
if (xx && rc == 0) rc = xx;
db->_dbi[dbix] = NULL;
}
- db->db_errpfx = _free(db->db_errpfx);
db->db_root = _free(db->db_root);
db->db_home = _free(db->db_home);
db->db_fullpath = _free(db->db_fullpath);
int mode, int perms, int flags)
{
rpmdb db = xcalloc(sizeof(*db), 1);
- const char * epfx = _DB_ERRPFX;
static int _initialized = 0;
if (!_initialized) {
}
db->db_root = rpmGetPath((root && *root) ? root : _DB_ROOT, NULL);
db->db_fullpath = rpmGenPath(db->db_root, db->db_home, NULL);
- db->db_errpfx = rpmExpand( (epfx && *epfx ? epfx : _DB_ERRPFX), NULL);
/* XXX remove environment after chrooted operations, for now... */
db->db_remove_env = (!rstreq(db->db_root, "/") ? 1 : 0);
db->_dbi = xcalloc(dbiTagsMax, sizeof(*db->_dbi));
int db_mode; /*!< open mode */
int db_perms; /*!< open permissions */
int db_api; /*!< Berkeley API type */
- char * db_errpfx;
int db_remove_env;
int db_chrootDone; /*!< If chroot(2) done, ignore db_root. */
int db_mkdirDone; /*!< Has db_home been created? */