From cb58dc6ce7f7ae53a67a4563985bf4987a7179d9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 9 Oct 2012 18:46:25 +0000 Subject: [PATCH] -use defaultconfig if config is missing --- src/arm/arm.conf.in | 1 + src/arm/gnunet-service-arm.c | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/arm/arm.conf.in b/src/arm/arm.conf.in index e7620b8ff..403cc5673 100644 --- a/src/arm/arm.conf.in +++ b/src/arm/arm.conf.in @@ -10,6 +10,7 @@ DEFAULTSERVICES = topology hostlist dht nse mesh fs UNIXPATH = /tmp/gnunet-service-arm.sock UNIX_MATCH_UID = YES UNIX_MATCH_GID = YES +CONFIG = $DEFAULTCONFIG # In the "-l" option, format characters from 'strftime' are allowed; # In the GLOBAL_POSTFIX, "{}" stands for the name of the respective diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index c860a810c..b43a482ba 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -1118,21 +1118,25 @@ setup_service (void *cls, const char *section) return; } config = NULL; - if ((GNUNET_OK != - GNUNET_CONFIGURATION_get_value_filename (cfg, section, "CONFIG", - &config)) || + if (( (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_filename (cfg, section, "CONFIG", + &config)) && + (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_filename (cfg, "PATHS", "DEFAULTCONFIG", + &config)) ) || + (0 != STAT (config, &sbuf))) - { - if (NULL == config) - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, section, "CONFIG"); - else - GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, - section, "CONFIG", - STRERROR (errno)); - GNUNET_free (binary); - GNUNET_free_non_null (config); - return; - } + { + if (NULL == config) + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, section, "CONFIG"); + else + GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, + section, "CONFIG", + STRERROR (errno)); + GNUNET_free (binary); + GNUNET_free_non_null (config); + return; + } sl = GNUNET_malloc (sizeof (struct ServiceList)); sl->name = GNUNET_strdup (section); sl->binary = binary; -- 2.25.1