fix #4546
authorChristian Grothoff <christian@grothoff.org>
Wed, 1 Jun 2016 20:00:51 +0000 (20:00 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 1 Jun 2016 20:00:51 +0000 (20:00 +0000)
src/arm/gnunet-service-arm.c

index 152a358fc3550a032ef9786186181bfc52d772e7..5014faa15dabbc5e87c5c8c2cf206381132cf335 100644 (file)
@@ -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,