From 92e8e09d4c906964ece19869b0346113126d5255 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 1 Jun 2016 20:00:51 +0000 Subject: fix #4546 --- src/arm/gnunet-service-arm.c | 50 ++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 152a358fc..5014faa15 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -450,26 +450,50 @@ start_process (struct ServiceList *sl, if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, sl->name, "OPTIONS", &options)) + options = NULL; + else + options = GNUNET_CONFIGURATION_expand_dollar (cfg, options); + { + char *new_options; + char *optpos; + char *fin_options; + + fin_options = GNUNET_strdup (final_option); + /* replace '{}' with service name */ + while (NULL != (optpos = strstr (fin_options, "{}"))) + { + /* terminate string at opening parenthesis */ + *optpos = 0; + GNUNET_asprintf (&new_options, + "%s%s%s", + fin_options, + sl->name, + optpos + 2); + GNUNET_free (fin_options); + fin_options = new_options; + } + if (NULL != options) { - char *new_options; - char *optpos; - options = GNUNET_strdup (final_option); - /* replace '{}' with service name */ - while (NULL != (optpos = strstr (options, "{}"))) - { - /* terminate string at opening parenthesis */ - *optpos = 0; - GNUNET_asprintf (&new_options, "%s%s%s", options, sl->name, optpos + 2); - GNUNET_free (options); - options = new_options; - } - options = GNUNET_CONFIGURATION_expand_dollar (cfg, options); + /* combine "fin_options" with "options" */ + optpos = options; + GNUNET_asprintf (&options, + "%s %s", + optpos, + fin_options); + GNUNET_free (optpos); } + else + { + /* only have "fin_options", use that */ + options = fin_options; + } + } use_debug = GNUNET_CONFIGURATION_get_value_yesno (cfg, sl->name, "DEBUG"); { const char *service_type = NULL; const char *choices[] = { "GNUNET", "SIMPLE", NULL }; + is_simple_service = GNUNET_NO; if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_choice (cfg, -- cgit v1.2.3