diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-11-05 13:40:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-11-05 13:40:39 +0000 |
commit | 4562b4f0679c784be5e7af59f3aec3c0d5de3fb5 (patch) | |
tree | afdde47167ea63e0e75c5dd68e18339e2599193c /src/arm | |
parent | d62b7637d968e8d587d2a7141a700f19eb1bcc98 (diff) | |
download | gnunet-4562b4f0679c784be5e7af59f3aec3c0d5de3fb5.tar.gz gnunet-4562b4f0679c784be5e7af59f3aec3c0d5de3fb5.zip |
-allow config-less services to start
Diffstat (limited to 'src/arm')
-rw-r--r-- | src/arm/gnunet-service-arm.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index c30fc57c7..8b2c5c224 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c | |||
@@ -315,15 +315,31 @@ start_process (struct ServiceList *sl) | |||
315 | binary = GNUNET_OS_get_libexec_binary_path (sl->binary); | 315 | binary = GNUNET_OS_get_libexec_binary_path (sl->binary); |
316 | GNUNET_assert (NULL == sl->proc); | 316 | GNUNET_assert (NULL == sl->proc); |
317 | if (GNUNET_YES == use_debug) | 317 | if (GNUNET_YES == use_debug) |
318 | sl->proc = | 318 | { |
319 | do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | 319 | if (NULL == sl->config) |
320 | lsocks, loprefix, binary, "-c", sl->config, "-L", | 320 | sl->proc = |
321 | "DEBUG", options, NULL); | 321 | do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
322 | lsocks, loprefix, binary, "-L", | ||
323 | "DEBUG", options, NULL); | ||
324 | else | ||
325 | sl->proc = | ||
326 | do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | ||
327 | lsocks, loprefix, binary, "-c", sl->config, "-L", | ||
328 | "DEBUG", options, NULL); | ||
329 | } | ||
322 | else | 330 | else |
323 | sl->proc = | 331 | { |
324 | do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | 332 | if (NULL == sl->config) |
325 | lsocks, loprefix, binary, "-c", sl->config, | 333 | sl->proc = |
326 | options, NULL); | 334 | do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
335 | lsocks, loprefix, binary, | ||
336 | options, NULL); | ||
337 | else | ||
338 | sl->proc = | ||
339 | do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | ||
340 | lsocks, loprefix, binary, "-c", sl->config, | ||
341 | options, NULL); | ||
342 | } | ||
327 | GNUNET_free (binary); | 343 | GNUNET_free (binary); |
328 | if (sl->proc == NULL) | 344 | if (sl->proc == NULL) |
329 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to start service `%s'\n"), | 345 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to start service `%s'\n"), |
@@ -1118,18 +1134,16 @@ setup_service (void *cls, const char *section) | |||
1118 | (GNUNET_OK != | 1134 | (GNUNET_OK != |
1119 | GNUNET_CONFIGURATION_get_value_filename (cfg, "PATHS", "DEFAULTCONFIG", | 1135 | GNUNET_CONFIGURATION_get_value_filename (cfg, "PATHS", "DEFAULTCONFIG", |
1120 | &config)) ) || | 1136 | &config)) ) || |
1121 | |||
1122 | (0 != STAT (config, &sbuf))) | 1137 | (0 != STAT (config, &sbuf))) |
1123 | { | 1138 | { |
1124 | if (NULL == config) | 1139 | if (NULL != config) |
1125 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, section, "CONFIG"); | 1140 | { |
1126 | else | ||
1127 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, | 1141 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, |
1128 | section, "CONFIG", | 1142 | section, "CONFIG", |
1129 | STRERROR (errno)); | 1143 | STRERROR (errno)); |
1130 | GNUNET_free (binary); | 1144 | GNUNET_free (config); |
1131 | GNUNET_free_non_null (config); | 1145 | config = NULL; |
1132 | return; | 1146 | } |
1133 | } | 1147 | } |
1134 | sl = GNUNET_malloc (sizeof (struct ServiceList)); | 1148 | sl = GNUNET_malloc (sizeof (struct ServiceList)); |
1135 | sl->name = GNUNET_strdup (section); | 1149 | sl->name = GNUNET_strdup (section); |