summaryrefslogtreecommitdiff
path: root/src/util/testdb.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-03 15:46:06 -0500
committerDan McGee <dan@archlinux.org>2011-06-07 11:37:05 -0500
commit19755b648c80f637a430ba5c914db76264024c9a (patch)
tree49ff0f6940ca12b5e0160ef0bf1637059218941d /src/util/testdb.c
parentfb4b422fc4567238332050b9a6c8c1cac2a8f091 (diff)
downloadpacman-19755b648c80f637a430ba5c914db76264024c9a.tar.xz
Update utilities for new initialize/release methods
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/util/testdb.c')
-rw-r--r--src/util/testdb.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/util/testdb.c b/src/util/testdb.c
index d8a2fb4d..06c01f8d 100644
--- a/src/util/testdb.c
+++ b/src/util/testdb.c
@@ -31,9 +31,11 @@
#define BASENAME "testdb"
+pmhandle_t *handle = NULL;
+
static void cleanup(int signum) {
- if(alpm_release() == -1) {
- fprintf(stderr, "error releasing alpm: %s\n", alpm_strerrorlast());
+ if(handle && alpm_release(handle) == -1) {
+ fprintf(stderr, "error releasing alpm\n");
}
exit(signum);
@@ -184,6 +186,7 @@ static void usage(void) {
int main(int argc, char *argv[])
{
int ret = 0;
+ enum _pmerrno_t err;
const char *dbpath = DBPATH;
int a = 1;
alpm_list_t *dbnames = NULL;
@@ -204,19 +207,15 @@ int main(int argc, char *argv[])
a++;
}
- if(alpm_initialize() == -1) {
- fprintf(stderr, "cannot initialize alpm: %s\n", alpm_strerrorlast());
+ handle = alpm_initialize(ROOTDIR, dbpath, &err);
+ if(!handle) {
+ fprintf(stderr, "cannot initialize alpm: %s\n", alpm_strerror(err));
return EXIT_FAILURE;
}
/* let us get log messages from libalpm */
alpm_option_set_logcb(output_cb);
- if(alpm_option_set_dbpath(dbpath) != 0) {
- fprintf(stderr, "cannot set dbpath: %s\n", alpm_strerrorlast());
- return EXIT_FAILURE;
- }
-
if(!dbnames) {
ret = check_localdb();
} else {