[PATHS]
SERVICEHOME = /var/lib/gnunet/
-DEFAULTCONFIG = /etc/gnunet.conf
+# DEFAULTCONFIG = /etc/gnunet.conf
+# If 'DEFAULTCONFIG' is not defined, the current
+# configuration file is assumed to be the default,
+# which is what we want by default...
[gnunetd]
HOSTKEY = $SERVICEHOME/.hostkey
(!((filename == NULL) ||
(GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, filename)))))
{
- GNUNET_free (baseconfig);
+ GNUNET_free (baseconfig);
return GNUNET_SYSERR;
}
GNUNET_free (baseconfig);
+ if ( ((GNUNET_YES != GNUNET_CONFIGURATION_have_value (cfg,
+ "PATHS",
+ "DEFAULTCONFIG"))) &&
+ (filename != NULL) )
+ GNUNET_CONFIGURATION_set_value_string (cfg,
+ "PATHS",
+ "DEFAULTCONFIG",
+ filename);
if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (cfg,
"TESTING",
"WEAKRANDOM")) &&
GNUNET_CONFIGURATION_get_value_time (sctx->cfg,
sctx->serviceName,
"TIMEOUT", &idleout))
- return GNUNET_SYSERR;
-
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Specified value for `%s' of service `%s' is invalid\n"),
+ "TIMEOUT",
+ sctx->serviceName);
+ return GNUNET_SYSERR;
+ }
sctx->timeout = idleout;
}
else
GNUNET_CONFIGURATION_get_value_number (sctx->cfg,
sctx->serviceName,
"MAXBUF", &maxbuf))
- return GNUNET_SYSERR;
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Specified value for `%s' of service `%s' is invalid\n"),
+ "MAXBUF",
+ sctx->serviceName);
+ return GNUNET_SYSERR;
+ }
}
else
maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE;
(sctx->allow_shutdown =
GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg, sctx->serviceName,
"ALLOW_SHUTDOWN")))
- return GNUNET_SYSERR;
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Specified value for `%s' of service `%s' is invalid\n"),
+ "ALLOW_SHUTDOWN",
+ sctx->serviceName);
+ return GNUNET_SYSERR;
+ }
}
else
sctx->allow_shutdown = GNUNET_NO;
(tolerant = GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg,
sctx->serviceName,
"TOLERANT")))
- return GNUNET_SYSERR;
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Specified value for `%s' of service `%s' is invalid\n"),
+ "TOLERANT",
+ sctx->serviceName);
+ return GNUNET_SYSERR;
+ }
}
else
tolerant = GNUNET_NO;
/* setup subsystems */
if (GNUNET_SYSERR == GNUNET_GETOPT_run (serviceName, service_options, argc,
argv))
- HANDLE_ERROR;
+ goto shutdown;
if (GNUNET_OK != GNUNET_log_setup (serviceName, loglev, logfile))
HANDLE_ERROR;
if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfg_fn))
- HANDLE_ERROR;
+ goto shutdown;
if (GNUNET_OK != setup_service (&sctx))
- HANDLE_ERROR;
+ goto shutdown;
if ( (do_daemonize == 1) && (GNUNET_OK != detach_terminal (&sctx)))
HANDLE_ERROR;
if (GNUNET_OK != set_user_id (&sctx))
- HANDLE_ERROR;
+ goto shutdown;
#if DEBUG_SERVICE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Service `%s' runs with configuration from `%s'\n",