]> the.earth.li Git - onak.git/blobdiff - onak.c
Cleanup db4 properly if we fail to open it.
[onak.git] / onak.c
diff --git a/onak.c b/onak.c
index 15154c42c55248e34a56140eee7fad5a691d77b8..e79e565a79779c08218101ea0c806f3ccedf6011 100644 (file)
--- a/onak.c
+++ b/onak.c
@@ -6,10 +6,9 @@
  * Jonathan McDowell <noodles@earth.li>
  * 
  * Copyright 2002 Project Purple
- *
- * $Id: onak.c,v 1.22 2004/05/31 14:16:49 noodles Exp $
  */
 
+#include <getopt.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -18,6 +17,8 @@
 #include "armor.h"
 #include "charfuncs.h"
 #include "cleankey.h"
+#include "cleanup.h"
+#include "config.h"
 #include "keydb.h"
 #include "keyid.h"
 #include "keyindex.h"
@@ -54,7 +55,7 @@ void find_keys(char *search, uint64_t keyid, bool ishex,
 }
 
 void usage(void) {
-       puts("onak " VERSION " - an OpenPGP keyserver.\n");
+       puts("onak " PACKAGE_VERSION " - an OpenPGP keyserver.\n");
        puts("Usage:\n");
        puts("\tonak [options] <command> <parameters>\n");
        puts("\tCommands:\n");
@@ -114,6 +115,7 @@ int main(int argc, char *argv[])
 
        readconfig(configfile);
        initlogthing("onak", config.logfile);
+       catchsignals();
 
        if ((argc - optind) < 1) {
                usage();
@@ -143,7 +145,7 @@ int main(int argc, char *argv[])
 
                        initdb(false);
                        logthing(LOGTHING_NOTICE, "Got %d new keys.",
-                                       update_keys(&keys));
+                                       update_keys(&keys, false));
                        if (keys != NULL && update) {
                                flatten_publickey(keys,
                                        &packets,