]> the.earth.li Git - onak.git/blobdiff - cgi/lookup.c
0.6.3 release
[onak.git] / cgi / lookup.c
index 5977ad0fd838ec0b2a225b7988e680106ddf371c..2006e475cea9d70dba5c90aef601a93fc4a0f51e 100644 (file)
@@ -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();
        }