[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r3795 - trunk/OpenDNSSEC/signer/src/daemon

Matthijs Mekking matthijs at nlnetlabs.nl
Thu Aug 26 11:04:18 CEST 2010


Author: matthijs
Date: 2010-08-26 11:04:17 +0200 (Thu, 26 Aug 2010)
New Revision: 3795

Modified:
   trunk/OpenDNSSEC/signer/src/daemon/engine.c
Log:
open hsm before open log

Modified: trunk/OpenDNSSEC/signer/src/daemon/engine.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/daemon/engine.c	2010-08-26 08:54:24 UTC (rev 3794)
+++ trunk/OpenDNSSEC/signer/src/daemon/engine.c	2010-08-26 09:04:17 UTC (rev 3795)
@@ -381,7 +381,6 @@
 engine_setup(engine_type* engine)
 {
     struct sigaction action;
-    int result = 0;
 
     se_log_assert(engine);
     se_log_assert(engine->config);
@@ -464,13 +463,6 @@
     sigaction(SIGHUP, &action, NULL);
     sigaction(SIGTERM, &action, NULL);
 
-    /* set up hsm */
-    result = hsm_open(engine->config->cfg_filename, hsm_prompt_pin, NULL); /* LEAKS */
-    if (result != HSM_OK) {
-        se_log_error("Error initializing libhsm (errno %i)", result);
-        return 1;
-    }
-
     /* set up the work floor */
     engine->tasklist = tasklist_create(); /* tasks */
     engine->zonelist = zonelist_create(); /* zones */
@@ -731,6 +723,7 @@
 {
     engine_type* engine = NULL;
     int use_syslog = 0;
+    int result = 0;
 
     se_log_assert(cfgfile);
     se_log_init(NULL, use_syslog, cmdline_verbosity);
@@ -746,23 +739,17 @@
     engine->config = engine_config(cfgfile, cmdline_verbosity);
     if (engine_check_config(engine->config) != 0) {
         se_log_error("cfgfile %s has errors", cfgfile?cfgfile:"(null)");
-        engine->need_to_exit = 1;
-        xmlCleanupParser();
-        xmlCleanupGlobals();
-        xmlCleanupThreads();
-        engine_cleanup(engine);
-        engine = NULL;
-        return;
     }
     if (info) {
         engine_config_print(stdout, engine->config);
-        xmlCleanupParser();
-        xmlCleanupGlobals();
-        xmlCleanupThreads();
-        engine_cleanup(engine);
-        engine = NULL;
-        return;
+        goto earlyexit;
     }
+    /* set up hsm */
+    result = hsm_open(engine->config->cfg_filename, hsm_prompt_pin, NULL); /* LEAKS */
+    if (result != HSM_OK) {
+        se_log_error("Error initializing libhsm (errno %i)", result);
+        goto earlyexit;
+    }
 
     /* open log */
     se_log_init(engine->config->log_filename, engine->config->use_syslog,
@@ -809,6 +796,8 @@
     }
     (void)unlink(engine->config->pid_filename);
     (void)unlink(engine->config->clisock_filename);
+
+earlyexit:
     engine_cleanup(engine);
     engine = NULL;
     se_log_close();




More information about the Opendnssec-commits mailing list