diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-01-25 16:02:41 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-01-25 16:02:41 +0000 |
commit | d7e4567be6be61831e950882f40759c4a9ca6e1d (patch) | |
tree | d9d09fcb328b3210f5f4a353547d7f62824af6f5 /src/arm | |
parent | 30c5c323f28ade8a1e7c6c593778793e44accb3a (diff) | |
download | gnunet-d7e4567be6be61831e950882f40759c4a9ca6e1d.tar.gz gnunet-d7e4567be6be61831e950882f40759c4a9ca6e1d.zip |
start gnunet-service-arm nicely if configuration file does not exist
Diffstat (limited to 'src/arm')
-rw-r--r-- | src/arm/arm_api.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index 517938d8c..fd49a18a5 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c | |||
@@ -359,17 +359,7 @@ arm_service_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
359 | if (GNUNET_OK != | 359 | if (GNUNET_OK != |
360 | GNUNET_CONFIGURATION_get_value_filename (pos->h->cfg, "arm", "CONFIG", | 360 | GNUNET_CONFIGURATION_get_value_filename (pos->h->cfg, "arm", "CONFIG", |
361 | &config)) | 361 | &config)) |
362 | { | 362 | config = NULL; |
363 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, | ||
364 | "arm", "CONFIG"); | ||
365 | if (pos->callback != NULL) | ||
366 | pos->callback (pos->cls, GNUNET_ARM_PROCESS_UNKNOWN); | ||
367 | GNUNET_free (cbinary); | ||
368 | GNUNET_free (pos); | ||
369 | GNUNET_free (loprefix); | ||
370 | GNUNET_free (lopostfix); | ||
371 | return; | ||
372 | } | ||
373 | binary = GNUNET_OS_get_libexec_binary_path (cbinary); | 363 | binary = GNUNET_OS_get_libexec_binary_path (cbinary); |
374 | GNUNET_free (cbinary); | 364 | GNUNET_free (cbinary); |
375 | if ((GNUNET_YES == | 365 | if ((GNUNET_YES == |
@@ -383,28 +373,39 @@ arm_service_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
383 | { | 373 | { |
384 | /* Means we are ONLY running locally */ | 374 | /* Means we are ONLY running locally */ |
385 | /* we're clearly running a test, don't daemonize */ | 375 | /* we're clearly running a test, don't daemonize */ |
386 | proc = do_start_process (GNUNET_NO, pos->std_inheritance, | 376 | if (NULL == config) |
387 | NULL, loprefix, binary, "-c", config, | 377 | proc = do_start_process (GNUNET_NO, pos->std_inheritance, |
388 | /* no daemonization! */ | 378 | NULL, loprefix, binary, |
389 | lopostfix, NULL); | 379 | /* no daemonization! */ |
380 | lopostfix, NULL); | ||
381 | else | ||
382 | proc = do_start_process (GNUNET_NO, pos->std_inheritance, | ||
383 | NULL, loprefix, binary, "-c", config, | ||
384 | /* no daemonization! */ | ||
385 | lopostfix, NULL); | ||
390 | } | 386 | } |
391 | else | 387 | else |
392 | { | 388 | { |
393 | proc = do_start_process (GNUNET_NO, pos->std_inheritance, | 389 | if (NULL == config) |
394 | NULL, loprefix, binary, "-c", config, | 390 | proc = do_start_process (GNUNET_NO, pos->std_inheritance, |
395 | "-d", lopostfix, NULL); | 391 | NULL, loprefix, binary, |
392 | "-d", lopostfix, NULL); | ||
393 | else | ||
394 | proc = do_start_process (GNUNET_NO, pos->std_inheritance, | ||
395 | NULL, loprefix, binary, "-c", config, | ||
396 | "-d", lopostfix, NULL); | ||
396 | } | 397 | } |
397 | GNUNET_free (binary); | 398 | GNUNET_free (binary); |
398 | GNUNET_free (config); | 399 | GNUNET_free_non_null (config); |
399 | GNUNET_free (loprefix); | 400 | GNUNET_free (loprefix); |
400 | GNUNET_free (lopostfix); | 401 | GNUNET_free (lopostfix); |
401 | if (proc == NULL) | 402 | if (NULL == proc) |
402 | { | 403 | { |
403 | if (pos->callback != NULL) | 404 | if (pos->callback != NULL) |
404 | pos->callback (pos->cls, GNUNET_ARM_PROCESS_FAILURE); | 405 | pos->callback (pos->cls, GNUNET_ARM_PROCESS_FAILURE); |
405 | GNUNET_free (pos); | 406 | GNUNET_free (pos); |
406 | return; | 407 | return; |
407 | } | 408 | } |
408 | if (pos->callback != NULL) | 409 | if (pos->callback != NULL) |
409 | pos->callback (pos->cls, GNUNET_ARM_PROCESS_STARTING); | 410 | pos->callback (pos->cls, GNUNET_ARM_PROCESS_STARTING); |
410 | GNUNET_free (proc); | 411 | GNUNET_free (proc); |