X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/62078c1601192c2594b954a122ac44a0c319c9bd..0d38a62f4c8e92149a5daade98079fb7445b7a0b:/keydb_db2.c?ds=inline diff --git a/keydb_db2.c b/keydb_db2.c index a30b62c..0c597c4 100644 --- a/keydb_db2.c +++ b/keydb_db2.c @@ -21,6 +21,7 @@ #include "keyid.h" #include "keyindex.h" #include "keystructs.h" +#include "log.h" #include "mem.h" #include "onak-conf.h" #include "parsekey.h" @@ -78,7 +79,7 @@ void initdb(void) */ db2_env.mp_size = 20 * 1024 * 1024; - ret = db_appinit(config.db2_dbpath, NULL, + ret = db_appinit(config.db_dir, NULL, &db2_env, DB_INIT_MPOOL|DB_INIT_LOCK); if (!ret) { db2_keydbfiles = (DB **) malloc(sizeof (DB *) * db2_numdb); @@ -91,13 +92,15 @@ void initdb(void) &db2_env, &keydbinfo, &db2_keydbfiles[i]); if (ret) { - fprintf(stderr, "Error opening db file %d (errno %d)\n", + logthing(LOGTHING_CRITICAL, + "Error opening db file %d (errno %d)", i, ret); exit(1); } } } else { - fprintf(stderr, "Error initializing db (%d).\n", ret); + logthing(LOGTHING_CRITICAL, "Error initializing db (%d).", + ret); exit(1); } } @@ -183,6 +186,8 @@ int fetch_key(uint64_t keyid, struct openpgp_publickey **publickey, fetchbuf.size = data.size; read_openpgp_stream(buffer_fetchchar, &fetchbuf, &packets); parse_keys(packets, publickey); + free_packet_list(packets); + packets = NULL; } return (!ret);