aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/defaults.conf5
-rw-r--r--doc/man/gnunet-peerinfo.12
-rw-r--r--src/util/configuration.c10
-rw-r--r--src/util/service.c41
4 files changed, 46 insertions, 12 deletions
diff --git a/contrib/defaults.conf b/contrib/defaults.conf
index 07bea3732..da25633eb 100644
--- a/contrib/defaults.conf
+++ b/contrib/defaults.conf
@@ -1,6 +1,9 @@
1[PATHS] 1[PATHS]
2SERVICEHOME = /var/lib/gnunet/ 2SERVICEHOME = /var/lib/gnunet/
3DEFAULTCONFIG = /etc/gnunet.conf 3# DEFAULTCONFIG = /etc/gnunet.conf
4# If 'DEFAULTCONFIG' is not defined, the current
5# configuration file is assumed to be the default,
6# which is what we want by default...
4 7
5[gnunetd] 8[gnunetd]
6HOSTKEY = $SERVICEHOME/.hostkey 9HOSTKEY = $SERVICEHOME/.hostkey
diff --git a/doc/man/gnunet-peerinfo.1 b/doc/man/gnunet-peerinfo.1
index d25dfa3d3..3eb2157d6 100644
--- a/doc/man/gnunet-peerinfo.1
+++ b/doc/man/gnunet-peerinfo.1
@@ -15,7 +15,7 @@ gnunet\-peerinfo \- Display information about other peers.
15.SH OPTIONS 15.SH OPTIONS
16.B 16.B
17.IP "\-c FILENAME, \-\-config=FILENAME" 17.IP "\-c FILENAME, \-\-config=FILENAME"
18Load config file (default: /etc/gnunet.conf) 18Load config file (default: ~/.gnunet/gnunet.conf)
19.B 19.B
20.IP "\-h, \-\-help" 20.IP "\-h, \-\-help"
21Print help page 21Print help page
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 41eeeb461..167fd375a 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -1140,10 +1140,18 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
1140 (!((filename == NULL) || 1140 (!((filename == NULL) ||
1141 (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, filename))))) 1141 (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, filename)))))
1142 { 1142 {
1143 GNUNET_free (baseconfig); 1143 GNUNET_free (baseconfig);
1144 return GNUNET_SYSERR; 1144 return GNUNET_SYSERR;
1145 } 1145 }
1146 GNUNET_free (baseconfig); 1146 GNUNET_free (baseconfig);
1147 if ( ((GNUNET_YES != GNUNET_CONFIGURATION_have_value (cfg,
1148 "PATHS",
1149 "DEFAULTCONFIG"))) &&
1150 (filename != NULL) )
1151 GNUNET_CONFIGURATION_set_value_string (cfg,
1152 "PATHS",
1153 "DEFAULTCONFIG",
1154 filename);
1147 if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (cfg, 1155 if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (cfg,
1148 "TESTING", 1156 "TESTING",
1149 "WEAKRANDOM")) && 1157 "WEAKRANDOM")) &&
diff --git a/src/util/service.c b/src/util/service.c
index 210074017..e6fec7514 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -999,8 +999,13 @@ setup_service (struct GNUNET_SERVICE_Context *sctx)
999 GNUNET_CONFIGURATION_get_value_time (sctx->cfg, 999 GNUNET_CONFIGURATION_get_value_time (sctx->cfg,
1000 sctx->serviceName, 1000 sctx->serviceName,
1001 "TIMEOUT", &idleout)) 1001 "TIMEOUT", &idleout))
1002 return GNUNET_SYSERR; 1002 {
1003 1003 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1004 _("Specified value for `%s' of service `%s' is invalid\n"),
1005 "TIMEOUT",
1006 sctx->serviceName);
1007 return GNUNET_SYSERR;
1008 }
1004 sctx->timeout = idleout; 1009 sctx->timeout = idleout;
1005 } 1010 }
1006 else 1011 else
@@ -1012,7 +1017,13 @@ setup_service (struct GNUNET_SERVICE_Context *sctx)
1012 GNUNET_CONFIGURATION_get_value_number (sctx->cfg, 1017 GNUNET_CONFIGURATION_get_value_number (sctx->cfg,
1013 sctx->serviceName, 1018 sctx->serviceName,
1014 "MAXBUF", &maxbuf)) 1019 "MAXBUF", &maxbuf))
1015 return GNUNET_SYSERR; 1020 {
1021 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1022 _("Specified value for `%s' of service `%s' is invalid\n"),
1023 "MAXBUF",
1024 sctx->serviceName);
1025 return GNUNET_SYSERR;
1026 }
1016 } 1027 }
1017 else 1028 else
1018 maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE; 1029 maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE;
@@ -1023,7 +1034,13 @@ setup_service (struct GNUNET_SERVICE_Context *sctx)
1023 (sctx->allow_shutdown = 1034 (sctx->allow_shutdown =
1024 GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg, sctx->serviceName, 1035 GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg, sctx->serviceName,
1025 "ALLOW_SHUTDOWN"))) 1036 "ALLOW_SHUTDOWN")))
1026 return GNUNET_SYSERR; 1037 {
1038 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1039 _("Specified value for `%s' of service `%s' is invalid\n"),
1040 "ALLOW_SHUTDOWN",
1041 sctx->serviceName);
1042 return GNUNET_SYSERR;
1043 }
1027 } 1044 }
1028 else 1045 else
1029 sctx->allow_shutdown = GNUNET_NO; 1046 sctx->allow_shutdown = GNUNET_NO;
@@ -1036,7 +1053,13 @@ setup_service (struct GNUNET_SERVICE_Context *sctx)
1036 (tolerant = GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg, 1053 (tolerant = GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg,
1037 sctx->serviceName, 1054 sctx->serviceName,
1038 "TOLERANT"))) 1055 "TOLERANT")))
1039 return GNUNET_SYSERR; 1056 {
1057 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1058 _("Specified value for `%s' of service `%s' is invalid\n"),
1059 "TOLERANT",
1060 sctx->serviceName);
1061 return GNUNET_SYSERR;
1062 }
1040 } 1063 }
1041 else 1064 else
1042 tolerant = GNUNET_NO; 1065 tolerant = GNUNET_NO;
@@ -1417,17 +1440,17 @@ GNUNET_SERVICE_run (int argc,
1417 /* setup subsystems */ 1440 /* setup subsystems */
1418 if (GNUNET_SYSERR == GNUNET_GETOPT_run (serviceName, service_options, argc, 1441 if (GNUNET_SYSERR == GNUNET_GETOPT_run (serviceName, service_options, argc,
1419 argv)) 1442 argv))
1420 HANDLE_ERROR; 1443 goto shutdown;
1421 if (GNUNET_OK != GNUNET_log_setup (serviceName, loglev, logfile)) 1444 if (GNUNET_OK != GNUNET_log_setup (serviceName, loglev, logfile))
1422 HANDLE_ERROR; 1445 HANDLE_ERROR;
1423 if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfg_fn)) 1446 if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfg_fn))
1424 HANDLE_ERROR; 1447 goto shutdown;
1425 if (GNUNET_OK != setup_service (&sctx)) 1448 if (GNUNET_OK != setup_service (&sctx))
1426 HANDLE_ERROR; 1449 goto shutdown;
1427 if ( (do_daemonize == 1) && (GNUNET_OK != detach_terminal (&sctx))) 1450 if ( (do_daemonize == 1) && (GNUNET_OK != detach_terminal (&sctx)))
1428 HANDLE_ERROR; 1451 HANDLE_ERROR;
1429 if (GNUNET_OK != set_user_id (&sctx)) 1452 if (GNUNET_OK != set_user_id (&sctx))
1430 HANDLE_ERROR; 1453 goto shutdown;
1431#if DEBUG_SERVICE 1454#if DEBUG_SERVICE
1432 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1455 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1433 "Service `%s' runs with configuration from `%s'\n", 1456 "Service `%s' runs with configuration from `%s'\n",