#ifdef ENABLE_RPMDB
if (state->dbenvopened)
closedbenv(state);
+ if (state->dbpath_allocated)
+ solv_free((char *)state->dbpath);
#endif
if (state->rootdir)
solv_free(state->rootdir);
int dbenvopened; /* database environment opened */
int pkgdbopened; /* package database openend */
const char *dbpath; /* path to the database */
+ int dbpath_allocated; /* do we need to free the path? */
DB_ENV *dbenv; /* database environment */
DB *db; /* packages database */
int dbenvopened; /* database environment opened */
const char *dbpath; /* path to the database */
+ int dbpath_allocated; /* do we need to free the path? */
rpmts ts;
rpmdbMatchIterator mi; /* iterator over packages database */
static void
detect_dbpath(struct rpmdbstate *state)
{
+ state->dbpath = rpmExpand("%{?_dbpath}", NULL);
+ if (state->dbpath && *state->dbpath)
+ {
+ state->dbpath_allocated = 1;
+ return;
+ }
+ solv_free((char *)state->dbpath);
state->dbpath = access_rootdir(state, "/var/lib/rpm", W_OK) == -1
&& (access_rootdir(state, "/usr/share/rpm/Packages", R_OK) == 0 || access_rootdir(state, "/usr/share/rpm/rpmdb.sqlite", R_OK) == 0)
? "/usr/share/rpm" : "/var/lib/rpm";