summaryrefslogtreecommitdiffstats
path: root/src/util/pactree.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/pactree.c')
-rw-r--r--src/util/pactree.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/util/pactree.c b/src/util/pactree.c
index e9a2816e..e2210ea4 100644
--- a/src/util/pactree.c
+++ b/src/util/pactree.c
@@ -74,6 +74,7 @@ static struct color_choices no_color = {
};
/* globals */
+pmhandle_t *handle = NULL;
pmdb_t *db_local;
alpm_list_t *walked = NULL;
alpm_list_t *provisions = NULL;
@@ -89,21 +90,11 @@ const char *dbpath = DBPATH;
static int alpm_local_init(void)
{
- int ret;
-
- ret = alpm_initialize();
- if(ret != 0) {
- return ret;
- }
+ enum _pmerrno_t err;
- ret = alpm_option_set_root(ROOTDIR);
- if(ret != 0) {
- return ret;
- }
-
- ret = alpm_option_set_dbpath(dbpath);
- if(ret != 0) {
- return ret;
+ handle = alpm_initialize(ROOTDIR, dbpath, &err);
+ if(!handle) {
+ return -1;
}
db_local = alpm_option_get_localdb();
@@ -196,7 +187,7 @@ static void cleanup(void)
{
alpm_list_free(walked);
alpm_list_free(provisions);
- alpm_release();
+ alpm_release(handle);
}
/* pkg provides provision */