X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=cgi%2Fadd.c;h=90824ccce7b5715b9c350f693e42ab6a05f06029;hb=refs%2Fheads%2Fmain;hp=e17d3d9b2f18c05599502013ce54d2db6e4adfde;hpb=9ce8c6ced68d45b462abb4c6531b6476f4d1e681;p=onak.git diff --git a/cgi/add.c b/cgi/add.c index e17d3d9..90824cc 100644 --- a/cgi/add.c +++ b/cgi/add.c @@ -87,8 +87,13 @@ int main(int argc, char *argv[]) } catchsignals(); dbctx = config.dbinit(config.backend, false); - - count = cleankeys(&keys, config.clean_policies); + if (dbctx == NULL) { + logthing(LOGTHING_ERROR, + "Failed to open key database."); + goto err; + } + + count = cleankeys(dbctx, &keys, config.clean_policies); logthing(LOGTHING_INFO, "%d keys cleaned.", count); @@ -109,6 +114,7 @@ int main(int argc, char *argv[]) puts("No OpenPGP packets found in input."); end_html(); } +err: cleanuplogthing(); cleanupconfig(); }