diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-12-11 17:47:58 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-12-11 17:47:58 +0100 |
commit | cefc7647dc8db23452da80cfb4384cca641bb99d (patch) | |
tree | 80a7cecd85bacc33eb2baeb7da2c0a88e6b8d105 | |
parent | e68c4624f12fe7172ea6de5b4a5d89d9e49eae91 (diff) | |
download | gnunet-cefc7647dc8db23452da80cfb4384cca641bb99d.tar.gz gnunet-cefc7647dc8db23452da80cfb4384cca641bb99d.zip |
make sure peer launches if default config not found and -c not given
-rw-r--r-- | src/arm/arm_api.c | 3 | ||||
-rw-r--r-- | src/arm/gnunet-arm.c | 120 | ||||
-rw-r--r-- | src/util/gnunet-config.c | 16 | ||||
-rw-r--r-- | src/util/program.c | 93 | ||||
-rw-r--r-- | src/util/service.c | 51 |
5 files changed, 161 insertions, 122 deletions
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index 5e31e038e..571b837d2 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c | |||
@@ -680,7 +680,8 @@ start_arm_service (struct GNUNET_ARM_Handle *h, | |||
680 | loprefix, | 680 | loprefix, |
681 | quotedbinary, | 681 | quotedbinary, |
682 | "-d", /* do daemonize */ | 682 | "-d", /* do daemonize */ |
683 | lopostfix, NULL); | 683 | lopostfix, |
684 | NULL); | ||
684 | else | 685 | else |
685 | proc = GNUNET_OS_start_process_s (GNUNET_NO, | 686 | proc = GNUNET_OS_start_process_s (GNUNET_NO, |
686 | std_inheritance, | 687 | std_inheritance, |
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c index e8180e920..69e230f87 100644 --- a/src/arm/gnunet-arm.c +++ b/src/arm/gnunet-arm.c | |||
@@ -146,8 +146,8 @@ delete_files () | |||
146 | { | 146 | { |
147 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 147 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
148 | "Will attempt to remove configuration file %s and service directory %s\n", | 148 | "Will attempt to remove configuration file %s and service directory %s\n", |
149 | config_file, dir); | 149 | config_file, |
150 | 150 | dir); | |
151 | if (0 != UNLINK (config_file)) | 151 | if (0 != UNLINK (config_file)) |
152 | { | 152 | { |
153 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 153 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
@@ -159,7 +159,6 @@ delete_files () | |||
159 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 159 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
160 | _("Failed to remove servicehome directory %s\n"), | 160 | _("Failed to remove servicehome directory %s\n"), |
161 | dir); | 161 | dir); |
162 | |||
163 | } | 162 | } |
164 | } | 163 | } |
165 | 164 | ||
@@ -697,13 +696,11 @@ timeout_task_cb (void *cls) | |||
697 | static void | 696 | static void |
698 | run (void *cls, | 697 | run (void *cls, |
699 | char *const *args, | 698 | char *const *args, |
700 | const char *cfgfile, | ||
701 | const struct GNUNET_CONFIGURATION_Handle *c) | 699 | const struct GNUNET_CONFIGURATION_Handle *c) |
702 | { | 700 | { |
703 | char *armconfig; | 701 | char *armconfig; |
704 | 702 | ||
705 | cfg = GNUNET_CONFIGURATION_dup (c); | 703 | cfg = GNUNET_CONFIGURATION_dup (c); |
706 | config_file = cfgfile; | ||
707 | if (GNUNET_OK != | 704 | if (GNUNET_OK != |
708 | GNUNET_CONFIGURATION_get_value_string (cfg, | 705 | GNUNET_CONFIGURATION_get_value_string (cfg, |
709 | "PATHS", | 706 | "PATHS", |
@@ -715,30 +712,18 @@ run (void *cls, | |||
715 | "GNUNET_HOME"); | 712 | "GNUNET_HOME"); |
716 | return; | 713 | return; |
717 | } | 714 | } |
718 | if (NULL != cfgfile) | 715 | (void) GNUNET_CONFIGURATION_get_value_filename (cfg, |
719 | { | 716 | "arm", |
720 | if (GNUNET_OK != | 717 | "CONFIG", |
721 | GNUNET_CONFIGURATION_get_value_filename (cfg, | 718 | &config_file); |
722 | "arm", | ||
723 | "CONFIG", | ||
724 | &armconfig)) | ||
725 | { | ||
726 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
727 | "arm", | ||
728 | "CONFIG", | ||
729 | cfgfile); | ||
730 | } | ||
731 | else | ||
732 | GNUNET_free (armconfig); | ||
733 | } | ||
734 | if (NULL == (h = GNUNET_ARM_connect (cfg, | 719 | if (NULL == (h = GNUNET_ARM_connect (cfg, |
735 | &conn_status, | 720 | &conn_status, |
736 | NULL))) | 721 | NULL))) |
737 | return; | 722 | return; |
738 | if (monitor) | 723 | if (monitor) |
739 | m = GNUNET_ARM_monitor_start (cfg, | 724 | m = GNUNET_ARM_monitor_start (cfg, |
740 | &srv_status, | 725 | &srv_status, |
741 | NULL); | 726 | NULL); |
742 | al_task = GNUNET_SCHEDULER_add_now (&action_loop, | 727 | al_task = GNUNET_SCHEDULER_add_now (&action_loop, |
743 | NULL); | 728 | NULL); |
744 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | 729 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, |
@@ -758,84 +743,77 @@ run (void *cls, | |||
758 | * @return 0 ok, 1 on error, 2 on timeout | 743 | * @return 0 ok, 1 on error, 2 on timeout |
759 | */ | 744 | */ |
760 | int | 745 | int |
761 | main (int argc, char *const *argv) | 746 | main (int argc, |
747 | char *const *argv) | ||
762 | { | 748 | { |
763 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 749 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
764 | |||
765 | GNUNET_GETOPT_option_flag ('e', | 750 | GNUNET_GETOPT_option_flag ('e', |
766 | "end", | 751 | "end", |
767 | gettext_noop ("stop all GNUnet services"), | 752 | gettext_noop ("stop all GNUnet services"), |
768 | &end), | 753 | &end), |
769 | |||
770 | GNUNET_GETOPT_option_string ('i', | 754 | GNUNET_GETOPT_option_string ('i', |
771 | "init", | 755 | "init", |
772 | "SERVICE", | 756 | "SERVICE", |
773 | gettext_noop ("start a particular service"), | 757 | gettext_noop ("start a particular service"), |
774 | &init), | 758 | &init), |
775 | |||
776 | GNUNET_GETOPT_option_string ('k', | 759 | GNUNET_GETOPT_option_string ('k', |
777 | "kill", | 760 | "kill", |
778 | "SERVICE", | 761 | "SERVICE", |
779 | gettext_noop ("stop a particular service"), | 762 | gettext_noop ("stop a particular service"), |
780 | &term), | 763 | &term), |
781 | |||
782 | GNUNET_GETOPT_option_flag ('s', | 764 | GNUNET_GETOPT_option_flag ('s', |
783 | "start", | 765 | "start", |
784 | gettext_noop ("start all GNUnet default services"), | 766 | gettext_noop ("start all GNUnet default services"), |
785 | &start), | 767 | &start), |
786 | |||
787 | GNUNET_GETOPT_option_flag ('r', | 768 | GNUNET_GETOPT_option_flag ('r', |
788 | "restart", | 769 | "restart", |
789 | gettext_noop ("stop and start all GNUnet default services"), | 770 | gettext_noop ("stop and start all GNUnet default services"), |
790 | &restart), | 771 | &restart), |
791 | GNUNET_GETOPT_option_flag ('d', | 772 | GNUNET_GETOPT_option_flag ('d', |
792 | "delete", | 773 | "delete", |
793 | gettext_noop ("delete config file and directory on exit"), | 774 | gettext_noop ("delete config file and directory on exit"), |
794 | &delete), | 775 | &delete), |
795 | |||
796 | GNUNET_GETOPT_option_flag ('m', | 776 | GNUNET_GETOPT_option_flag ('m', |
797 | "monitor", | 777 | "monitor", |
798 | gettext_noop ("monitor ARM activities"), | 778 | gettext_noop ("monitor ARM activities"), |
799 | &monitor), | 779 | &monitor), |
800 | |||
801 | GNUNET_GETOPT_option_flag ('q', | 780 | GNUNET_GETOPT_option_flag ('q', |
802 | "quiet", | 781 | "quiet", |
803 | gettext_noop ("don't print status messages"), | 782 | gettext_noop ("don't print status messages"), |
804 | &quiet), | 783 | &quiet), |
805 | |||
806 | GNUNET_GETOPT_option_relative_time ('T', | 784 | GNUNET_GETOPT_option_relative_time ('T', |
807 | "timeout", | 785 | "timeout", |
808 | "DELAY", | 786 | "DELAY", |
809 | gettext_noop ("exit with error status if operation does not finish after DELAY"), | 787 | gettext_noop ("exit with error status if operation does not finish after DELAY"), |
810 | &timeout), | 788 | &timeout), |
811 | |||
812 | GNUNET_GETOPT_option_flag ('I', | 789 | GNUNET_GETOPT_option_flag ('I', |
813 | "info", | 790 | "info", |
814 | gettext_noop ("list currently running services"), | 791 | gettext_noop ("list currently running services"), |
815 | &list), | 792 | &list), |
816 | |||
817 | GNUNET_GETOPT_option_flag ('O', | 793 | GNUNET_GETOPT_option_flag ('O', |
818 | "no-stdout", | 794 | "no-stdout", |
819 | gettext_noop ("don't let gnunet-service-arm inherit standard output"), | 795 | gettext_noop ("don't let gnunet-service-arm inherit standard output"), |
820 | &no_stdout), | 796 | &no_stdout), |
821 | |||
822 | GNUNET_GETOPT_option_flag ('E', | 797 | GNUNET_GETOPT_option_flag ('E', |
823 | "no-stderr", | 798 | "no-stderr", |
824 | gettext_noop ("don't let gnunet-service-arm inherit standard error"), | 799 | gettext_noop ("don't let gnunet-service-arm inherit standard error"), |
825 | &no_stderr), | 800 | &no_stderr), |
826 | |||
827 | GNUNET_GETOPT_OPTION_END | 801 | GNUNET_GETOPT_OPTION_END |
828 | }; | 802 | }; |
829 | 803 | ||
830 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, | 804 | if (GNUNET_OK != |
831 | &argc, &argv)) | 805 | GNUNET_STRINGS_get_utf8_args (argc, argv, |
806 | &argc, &argv)) | ||
832 | return 2; | 807 | return 2; |
833 | 808 | ||
834 | if (GNUNET_OK == | 809 | if (GNUNET_OK == |
835 | GNUNET_PROGRAM_run (argc, argv, "gnunet-arm", | 810 | GNUNET_PROGRAM_run (argc, |
811 | argv, | ||
812 | "gnunet-arm", | ||
836 | gettext_noop | 813 | gettext_noop |
837 | ("Control services and the Automated Restart Manager (ARM)"), | 814 | ("Control services and the Automated Restart Manager (ARM)"), |
838 | options, &run, NULL)) | 815 | options, |
816 | &run, NULL)) | ||
839 | { | 817 | { |
840 | GNUNET_free ((void *) argv); | 818 | GNUNET_free ((void *) argv); |
841 | return ret; | 819 | return ret; |
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 46c523da4..3c7eaa6dc 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -142,6 +142,7 @@ run (void *cls, | |||
142 | { | 142 | { |
143 | struct GNUNET_CONFIGURATION_Handle *out = NULL; | 143 | struct GNUNET_CONFIGURATION_Handle *out = NULL; |
144 | struct GNUNET_CONFIGURATION_Handle *diff = NULL; | 144 | struct GNUNET_CONFIGURATION_Handle *diff = NULL; |
145 | char *cfg_fn; | ||
145 | 146 | ||
146 | (void) cls; | 147 | (void) cls; |
147 | (void) args; | 148 | (void) args; |
@@ -236,6 +237,20 @@ run (void *cls, | |||
236 | option, | 237 | option, |
237 | value); | 238 | value); |
238 | } | 239 | } |
240 | cfg_fn = NULL; | ||
241 | if (NULL == cfgfile) | ||
242 | { | ||
243 | const char *xdg = getenv ("XDG_CONFIG_HOME"); | ||
244 | if (NULL != xdg) | ||
245 | GNUNET_asprintf (&cfg_fn, | ||
246 | "%s%s%s", | ||
247 | xdg, | ||
248 | DIR_SEPARATOR_STR, | ||
249 | GNUNET_OS_project_data_get ()->config_file); | ||
250 | else | ||
251 | cfg_fn = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file); | ||
252 | cfgfile = cfg_fn; | ||
253 | } | ||
239 | if ( (NULL != diff) || (NULL != out) ) | 254 | if ( (NULL != diff) || (NULL != out) ) |
240 | { | 255 | { |
241 | if (GNUNET_OK != | 256 | if (GNUNET_OK != |
@@ -243,6 +258,7 @@ run (void *cls, | |||
243 | cfgfile)) | 258 | cfgfile)) |
244 | ret = 2; | 259 | ret = 2; |
245 | } | 260 | } |
261 | GNUNET_free_non_null (cfg_fn); | ||
246 | if (NULL != out) | 262 | if (NULL != out) |
247 | GNUNET_CONFIGURATION_destroy (out); | 263 | GNUNET_CONFIGURATION_destroy (out); |
248 | cleanup: | 264 | cleanup: |
diff --git a/src/util/program.c b/src/util/program.c index da58348d0..2fa8676a2 100644 --- a/src/util/program.c +++ b/src/util/program.c | |||
@@ -87,9 +87,13 @@ program_main (void *cls) | |||
87 | struct CommandContext *cc = cls; | 87 | struct CommandContext *cc = cls; |
88 | 88 | ||
89 | GNUNET_SPEEDUP_start_(cc->cfg); | 89 | GNUNET_SPEEDUP_start_(cc->cfg); |
90 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); | 90 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, |
91 | NULL); | ||
91 | GNUNET_RESOLVER_connect (cc->cfg); | 92 | GNUNET_RESOLVER_connect (cc->cfg); |
92 | cc->task (cc->task_cls, cc->args, cc->cfgfile, cc->cfg); | 93 | cc->task (cc->task_cls, |
94 | cc->args, | ||
95 | cc->cfgfile, | ||
96 | cc->cfg); | ||
93 | } | 97 | } |
94 | 98 | ||
95 | 99 | ||
@@ -101,7 +105,8 @@ program_main (void *cls) | |||
101 | * @param a2 second command line option | 105 | * @param a2 second command line option |
102 | */ | 106 | */ |
103 | static int | 107 | static int |
104 | cmd_sorter (const void *a1, const void *a2) | 108 | cmd_sorter (const void *a1, |
109 | const void *a2) | ||
105 | { | 110 | { |
106 | const struct GNUNET_GETOPT_CommandLineOption *c1 = a1; | 111 | const struct GNUNET_GETOPT_CommandLineOption *c1 = a1; |
107 | const struct GNUNET_GETOPT_CommandLineOption *c2 = a2; | 112 | const struct GNUNET_GETOPT_CommandLineOption *c2 = a2; |
@@ -264,18 +269,17 @@ GNUNET_PROGRAM_run2 (int argc, | |||
264 | GNUNET_free (lpfx); | 269 | GNUNET_free (lpfx); |
265 | goto cleanup; | 270 | goto cleanup; |
266 | } | 271 | } |
267 | if (NULL == cc.cfgfile) | 272 | if (NULL != cc.cfgfile) |
268 | cc.cfgfile = GNUNET_strdup (cfg_fn); | ||
269 | if (GNUNET_YES == | ||
270 | GNUNET_DISK_file_test (cc.cfgfile)) | ||
271 | { | 273 | { |
272 | if (GNUNET_SYSERR == | 274 | if ( (GNUNET_YES != |
273 | GNUNET_CONFIGURATION_load (cfg, | 275 | GNUNET_DISK_file_test (cc.cfgfile)) || |
274 | cc.cfgfile)) | 276 | (GNUNET_SYSERR == |
277 | GNUNET_CONFIGURATION_load (cfg, | ||
278 | cc.cfgfile)) ) | ||
275 | { | 279 | { |
276 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 280 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
277 | _("Malformed configuration file `%s', exit ...\n"), | 281 | _("Unreadable or malformed configuration file `%s', exit ...\n"), |
278 | cc.cfgfile); | 282 | cc.cfgfile); |
279 | ret = GNUNET_SYSERR; | 283 | ret = GNUNET_SYSERR; |
280 | GNUNET_free (allopts); | 284 | GNUNET_free (allopts); |
281 | GNUNET_free (lpfx); | 285 | GNUNET_free (lpfx); |
@@ -284,16 +288,37 @@ GNUNET_PROGRAM_run2 (int argc, | |||
284 | } | 288 | } |
285 | else | 289 | else |
286 | { | 290 | { |
287 | if (0 != strcmp (cc.cfgfile, | 291 | if (GNUNET_YES == |
288 | cfg_fn)) | 292 | GNUNET_DISK_file_test (cfg_fn)) |
289 | { | 293 | { |
290 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 294 | if (GNUNET_SYSERR == |
291 | _("Could not access configuration file `%s'\n"), | 295 | GNUNET_CONFIGURATION_load (cfg, |
292 | cc.cfgfile); | 296 | cfg_fn)) |
293 | ret = GNUNET_SYSERR; | 297 | { |
294 | GNUNET_free (allopts); | 298 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
295 | GNUNET_free (lpfx); | 299 | _("Unreadable or malformed default configuration file `%s', exit ...\n"), |
296 | goto cleanup; | 300 | cfg_fn); |
301 | ret = GNUNET_SYSERR; | ||
302 | GNUNET_free (allopts); | ||
303 | GNUNET_free (lpfx); | ||
304 | goto cleanup; | ||
305 | } | ||
306 | } | ||
307 | else | ||
308 | { | ||
309 | GNUNET_free (cfg_fn); | ||
310 | cfg_fn = NULL; | ||
311 | if (GNUNET_OK != | ||
312 | GNUNET_CONFIGURATION_load (cfg, | ||
313 | NULL)) | ||
314 | { | ||
315 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
316 | _("Unreadable or malformed configuration, exit ...\n")); | ||
317 | ret = GNUNET_SYSERR; | ||
318 | GNUNET_free (allopts); | ||
319 | GNUNET_free (lpfx); | ||
320 | goto cleanup; | ||
321 | } | ||
297 | } | 322 | } |
298 | } | 323 | } |
299 | GNUNET_free (allopts); | 324 | GNUNET_free (allopts); |
@@ -320,20 +345,30 @@ GNUNET_PROGRAM_run2 (int argc, | |||
320 | has little business with ARM-specific options. */ | 345 | has little business with ARM-specific options. */ |
321 | if (GNUNET_YES != | 346 | if (GNUNET_YES != |
322 | GNUNET_CONFIGURATION_have_value (cfg, | 347 | GNUNET_CONFIGURATION_have_value (cfg, |
323 | "arm", | 348 | "arm", |
324 | "CONFIG")) | 349 | "CONFIG")) |
325 | { | 350 | { |
326 | GNUNET_CONFIGURATION_set_value_string (cfg, | 351 | if (NULL != cc.cfgfile) |
327 | "arm", | 352 | GNUNET_CONFIGURATION_set_value_string (cfg, |
328 | "CONFIG", | 353 | "arm", |
329 | cc.cfgfile); | 354 | "CONFIG", |
355 | cc.cfgfile); | ||
356 | else if (NULL != cfg_fn) | ||
357 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
358 | "arm", | ||
359 | "CONFIG", | ||
360 | cfg_fn); | ||
330 | } | 361 | } |
331 | 362 | ||
332 | /* run */ | 363 | /* run */ |
333 | cc.args = &argv[ret]; | 364 | cc.args = &argv[ret]; |
365 | if ( (NULL == cc.cfgfile) && | ||
366 | (NULL != cfg_fn) ) | ||
367 | cc.cfgfile = GNUNET_strdup (cfg_fn); | ||
334 | if (GNUNET_NO == run_without_scheduler) | 368 | if (GNUNET_NO == run_without_scheduler) |
335 | { | 369 | { |
336 | GNUNET_SCHEDULER_run (&program_main, &cc); | 370 | GNUNET_SCHEDULER_run (&program_main, |
371 | &cc); | ||
337 | } | 372 | } |
338 | else | 373 | else |
339 | { | 374 | { |
@@ -347,7 +382,7 @@ GNUNET_PROGRAM_run2 (int argc, | |||
347 | cleanup: | 382 | cleanup: |
348 | GNUNET_CONFIGURATION_destroy (cfg); | 383 | GNUNET_CONFIGURATION_destroy (cfg); |
349 | GNUNET_free_non_null (cc.cfgfile); | 384 | GNUNET_free_non_null (cc.cfgfile); |
350 | GNUNET_free (cfg_fn); | 385 | GNUNET_free_non_null (cfg_fn); |
351 | GNUNET_free_non_null (loglev); | 386 | GNUNET_free_non_null (loglev); |
352 | GNUNET_free_non_null (logfile); | 387 | GNUNET_free_non_null (logfile); |
353 | return ret; | 388 | return ret; |
diff --git a/src/util/service.c b/src/util/service.c index 2dc7dd576..098030ddf 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -1587,6 +1587,7 @@ return_agpl (void *cls, | |||
1587 | struct GNUNET_MessageHeader *res; | 1587 | struct GNUNET_MessageHeader *res; |
1588 | size_t slen; | 1588 | size_t slen; |
1589 | 1589 | ||
1590 | (void) msg; | ||
1590 | slen = strlen (GNUNET_AGPL_URL) + 1; | 1591 | slen = strlen (GNUNET_AGPL_URL) + 1; |
1591 | env = GNUNET_MQ_msg_extra (res, | 1592 | env = GNUNET_MQ_msg_extra (res, |
1592 | GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, | 1593 | GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, |
@@ -1811,37 +1812,45 @@ GNUNET_SERVICE_run_ (int argc, | |||
1811 | GNUNET_break (0); | 1812 | GNUNET_break (0); |
1812 | goto shutdown; | 1813 | goto shutdown; |
1813 | } | 1814 | } |
1814 | if (NULL == opt_cfg_filename) | 1815 | if (NULL != opt_cfg_filename) |
1815 | opt_cfg_filename = GNUNET_strdup (cfg_filename); | ||
1816 | if (GNUNET_YES == GNUNET_DISK_file_test (opt_cfg_filename)) | ||
1817 | { | 1816 | { |
1818 | if (GNUNET_SYSERR == | 1817 | if ( (GNUNET_YES != |
1819 | GNUNET_CONFIGURATION_load (cfg, | 1818 | GNUNET_DISK_file_test (opt_cfg_filename)) || |
1820 | opt_cfg_filename)) | 1819 | (GNUNET_SYSERR == |
1820 | GNUNET_CONFIGURATION_load (cfg, | ||
1821 | opt_cfg_filename)) ) | ||
1821 | { | 1822 | { |
1822 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1823 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1823 | _("Malformed configuration file `%s', exit ...\n"), | 1824 | _("Malformed configuration file `%s', exit ...\n"), |
1824 | opt_cfg_filename); | 1825 | opt_cfg_filename); |
1825 | goto shutdown; | 1826 | goto shutdown; |
1826 | } | 1827 | } |
1827 | } | 1828 | } |
1828 | else | 1829 | else |
1829 | { | 1830 | { |
1830 | if (GNUNET_SYSERR == | 1831 | if (GNUNET_YES == |
1831 | GNUNET_CONFIGURATION_load (cfg, | 1832 | GNUNET_DISK_file_test (cfg_filename)) |
1832 | NULL)) | ||
1833 | { | 1833 | { |
1834 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1834 | if (GNUNET_SYSERR == |
1835 | _("Malformed configuration, exit ...\n")); | 1835 | GNUNET_CONFIGURATION_load (cfg, |
1836 | goto shutdown; | 1836 | cfg_filename)) |
1837 | { | ||
1838 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1839 | _("Malformed configuration file `%s', exit ...\n"), | ||
1840 | cfg_filename); | ||
1841 | goto shutdown; | ||
1842 | } | ||
1837 | } | 1843 | } |
1838 | if (0 != strcmp (opt_cfg_filename, | 1844 | else |
1839 | cfg_filename)) | ||
1840 | { | 1845 | { |
1841 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1846 | if (GNUNET_SYSERR == |
1842 | _("Could not access configuration file `%s'\n"), | 1847 | GNUNET_CONFIGURATION_load (cfg, |
1843 | opt_cfg_filename); | 1848 | NULL)) |
1844 | goto shutdown; | 1849 | { |
1850 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1851 | _("Malformed configuration, exit ...\n")); | ||
1852 | goto shutdown; | ||
1853 | } | ||
1845 | } | 1854 | } |
1846 | } | 1855 | } |
1847 | if (GNUNET_OK != setup_service (&sh)) | 1856 | if (GNUNET_OK != setup_service (&sh)) |
@@ -1857,7 +1866,7 @@ GNUNET_SERVICE_run_ (int argc, | |||
1857 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1866 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1858 | "Service `%s' runs with configuration from `%s'\n", | 1867 | "Service `%s' runs with configuration from `%s'\n", |
1859 | service_name, | 1868 | service_name, |
1860 | opt_cfg_filename); | 1869 | (NULL != opt_cfg_filename) ? opt_cfg_filename : cfg_filename); |
1861 | if ((GNUNET_OK == | 1870 | if ((GNUNET_OK == |
1862 | GNUNET_CONFIGURATION_get_value_number (sh.cfg, | 1871 | GNUNET_CONFIGURATION_get_value_number (sh.cfg, |
1863 | "TESTING", | 1872 | "TESTING", |