X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=cgi%2Flookup.c;h=2006e475cea9d70dba5c90aef601a93fc4a0f51e;hb=9aadc77b48c7826015f8ec87cebdc15d012c5f14;hp=5977ad0fd838ec0b2a225b7988e680106ddf371c;hpb=8ee9a59daf7a1ab1bf4ad8f4d2bcb88282db58a8;p=onak.git diff --git a/cgi/lookup.c b/cgi/lookup.c index 5977ad0..2006e47 100644 --- a/cgi/lookup.c +++ b/cgi/lookup.c @@ -50,7 +50,7 @@ void find_keys(struct onak_dbctx *dbctx, char *search, uint64_t keyid, struct openpgp_fingerprint *fingerprint, bool ishex, bool isfp, bool dispfp, bool skshash, - bool exact, bool verbose, bool mrhkp) + __unused bool exact, bool verbose, bool mrhkp) { struct openpgp_publickey *publickey = NULL; int count = 0; @@ -228,6 +228,11 @@ int main(int argc, char *argv[]) initlogthing("lookup", config.logfile); catchsignals(); dbctx = config.dbinit(config.backend, false); + if (dbctx == NULL) { + logthing(LOGTHING_ERROR, + "Failed to open key database."); + goto err; + } switch (op) { case OP_GET: case OP_HGET: @@ -305,6 +310,7 @@ int main(int argc, char *argv[]) puts("Unknown operation!"); } dbctx->cleanupdb(dbctx); +err: cleanuplogthing(); cleanupconfig(); }