diff options
-rwxr-xr-x | contrib/pogen.sh | 4 | ||||
-rw-r--r-- | src/arm/arm_api.c | 54 | ||||
-rw-r--r-- | src/arm/gnunet-arm.c | 208 | ||||
-rw-r--r-- | src/arm/gnunet-service-arm.c | 11 | ||||
-rw-r--r-- | src/chat/chat.c | 5 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 6 | ||||
-rw-r--r-- | src/dv/test_transport_api_dv.c | 8 | ||||
-rw-r--r-- | src/fs/fs_namespace.c | 10 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_indexing.c | 10 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.c | 12 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_push.c | 7 | ||||
-rw-r--r-- | src/gns/gnunet-gns-fcfsd.c | 14 | ||||
-rw-r--r-- | src/include/gnunet_common.h | 30 | ||||
-rw-r--r-- | src/namestore/gnunet-namestore.c | 5 | ||||
-rw-r--r-- | src/namestore/plugin_namestore_sqlite.c | 7 | ||||
-rw-r--r-- | src/topology/gnunet-daemon-topology.c | 5 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_blacklist.c | 5 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 5 | ||||
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 14 | ||||
-rw-r--r-- | src/util/common_logging.c | 39 | ||||
-rw-r--r-- | src/util/gnunet-config.c | 8 |
21 files changed, 247 insertions, 220 deletions
diff --git a/contrib/pogen.sh b/contrib/pogen.sh index 604b5ae3b..1a4c072a7 100755 --- a/contrib/pogen.sh +++ b/contrib/pogen.sh | |||
@@ -1,3 +1,3 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | find src -name "*.c" | grep -v \# | grep -v /test_ | grep -v /perf_ | sort > po/POTFILES.in | 2 | find src -name "*.c" | grep -v \# | grep -v /test_ | grep -v /perf_ | grep -v _old | sort > po/POTFILES.in |
3 | grep -l _\( `find src -name "*.h"` | grep -v "platform.h" | sort >> po/POTFILES.in | 3 | grep -l _\( `find src -name "*.h"` | grep -v "platform.h" | grep -v _old | sort >> po/POTFILES.in |
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index a598a5fea..7c18c617e 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c | |||
@@ -349,10 +349,8 @@ arm_service_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
349 | GNUNET_CONFIGURATION_get_value_string (pos->h->cfg, "arm", "BINARY", | 349 | GNUNET_CONFIGURATION_get_value_string (pos->h->cfg, "arm", "BINARY", |
350 | &binary)) | 350 | &binary)) |
351 | { | 351 | { |
352 | LOG (GNUNET_ERROR_TYPE_WARNING, | 352 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, |
353 | _ | 353 | "arm", "BINARY"); |
354 | ("Configuration failes to specify option `%s' in section `%s'!\n"), | ||
355 | "BINARY", "arm"); | ||
356 | if (pos->callback != NULL) | 354 | if (pos->callback != NULL) |
357 | pos->callback (pos->cls, GNUNET_ARM_PROCESS_UNKNOWN); | 355 | pos->callback (pos->cls, GNUNET_ARM_PROCESS_UNKNOWN); |
358 | GNUNET_free (pos); | 356 | GNUNET_free (pos); |
@@ -364,9 +362,8 @@ arm_service_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
364 | GNUNET_CONFIGURATION_get_value_filename (pos->h->cfg, "arm", "CONFIG", | 362 | GNUNET_CONFIGURATION_get_value_filename (pos->h->cfg, "arm", "CONFIG", |
365 | &config)) | 363 | &config)) |
366 | { | 364 | { |
367 | LOG (GNUNET_ERROR_TYPE_WARNING, | 365 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, |
368 | _("Configuration fails to specify option `%s' in section `%s'!\n"), | 366 | "arm", "CONFIG"); |
369 | "CONFIG", "arm"); | ||
370 | if (pos->callback != NULL) | 367 | if (pos->callback != NULL) |
371 | pos->callback (pos->cls, GNUNET_ARM_PROCESS_UNKNOWN); | 368 | pos->callback (pos->cls, GNUNET_ARM_PROCESS_UNKNOWN); |
372 | GNUNET_free (binary); | 369 | GNUNET_free (binary); |
@@ -432,11 +429,7 @@ handle_response (void *cls, const struct GNUNET_MessageHeader *msg) | |||
432 | if ((msg == NULL) || | 429 | if ((msg == NULL) || |
433 | (ntohs (msg->size) != sizeof (struct GNUNET_ARM_ResultMessage))) | 430 | (ntohs (msg->size) != sizeof (struct GNUNET_ARM_ResultMessage))) |
434 | { | 431 | { |
435 | LOG (GNUNET_ERROR_TYPE_WARNING, | 432 | GNUNET_break (0); |
436 | _ | ||
437 | ("Error receiving response to `%s' request from ARM for service `%s'\n"), | ||
438 | (sc->type == GNUNET_MESSAGE_TYPE_ARM_START) ? "START" : "STOP", | ||
439 | (const char *) &sc[1]); | ||
440 | GNUNET_CLIENT_disconnect (sc->h->client); | 433 | GNUNET_CLIENT_disconnect (sc->h->client); |
441 | sc->h->client = GNUNET_CLIENT_connect ("arm", sc->h->cfg); | 434 | sc->h->client = GNUNET_CLIENT_connect ("arm", sc->h->cfg); |
442 | GNUNET_assert (NULL != sc->h->client); | 435 | GNUNET_assert (NULL != sc->h->client); |
@@ -487,8 +480,8 @@ change_service (struct GNUNET_ARM_Handle *h, const char *service_name, | |||
487 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 480 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
488 | (type == | 481 | (type == |
489 | GNUNET_MESSAGE_TYPE_ARM_START) ? | 482 | GNUNET_MESSAGE_TYPE_ARM_START) ? |
490 | _("Requesting start of service `%s'.\n") : | 483 | "Requesting start of service `%s'.\n" : |
491 | _("Requesting termination of service `%s'.\n"), service_name); | 484 | "Requesting termination of service `%s'.\n", service_name); |
492 | sctx = GNUNET_malloc (sizeof (struct RequestContext) + slen); | 485 | sctx = GNUNET_malloc (sizeof (struct RequestContext) + slen); |
493 | sctx->h = h; | 486 | sctx->h = h; |
494 | sctx->callback = cb; | 487 | sctx->callback = cb; |
@@ -506,12 +499,7 @@ change_service (struct GNUNET_ARM_Handle *h, const char *service_name, | |||
506 | (sctx->timeout), GNUNET_YES, | 499 | (sctx->timeout), GNUNET_YES, |
507 | &handle_response, sctx)) | 500 | &handle_response, sctx)) |
508 | { | 501 | { |
509 | LOG (GNUNET_ERROR_TYPE_WARNING, | 502 | GNUNET_break (0); |
510 | (type == | ||
511 | GNUNET_MESSAGE_TYPE_ARM_START) | ||
512 | ? _("Error while trying to transmit request to start `%s' to ARM\n") | ||
513 | : _("Error while trying to transmit request to stop `%s' to ARM\n"), | ||
514 | (const char *) &service_name); | ||
515 | if (cb != NULL) | 503 | if (cb != NULL) |
516 | cb (cb_cls, GNUNET_SYSERR); | 504 | cb (cb_cls, GNUNET_SYSERR); |
517 | GNUNET_free (sctx); | 505 | GNUNET_free (sctx); |
@@ -544,8 +532,8 @@ GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h, | |||
544 | size_t slen; | 532 | size_t slen; |
545 | 533 | ||
546 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 534 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
547 | _("Asked to start service `%s' within %llu ms\n"), service_name, | 535 | "Asked to start service `%s' within %s\n", service_name, |
548 | (unsigned long long) timeout.rel_value); | 536 | GNUNET_STRINGS_relative_time_to_string (timeout)); |
549 | if (0 == strcasecmp ("arm", service_name)) | 537 | if (0 == strcasecmp ("arm", service_name)) |
550 | { | 538 | { |
551 | slen = strlen ("arm") + 1; | 539 | slen = strlen ("arm") + 1; |
@@ -594,7 +582,6 @@ arm_shutdown_callback (void *cls, enum GNUNET_ARM_ProcessStatus reason) | |||
594 | 582 | ||
595 | if (arm_shutdown_ctx->cb != NULL) | 583 | if (arm_shutdown_ctx->cb != NULL) |
596 | arm_shutdown_ctx->cb (arm_shutdown_ctx->cb_cls, reason); | 584 | arm_shutdown_ctx->cb (arm_shutdown_ctx->cb_cls, reason); |
597 | |||
598 | GNUNET_free (arm_shutdown_ctx); | 585 | GNUNET_free (arm_shutdown_ctx); |
599 | } | 586 | } |
600 | 587 | ||
@@ -617,8 +604,10 @@ GNUNET_ARM_stop_service (struct GNUNET_ARM_Handle *h, | |||
617 | struct ARM_ShutdownContext *arm_shutdown_ctx; | 604 | struct ARM_ShutdownContext *arm_shutdown_ctx; |
618 | struct GNUNET_CLIENT_Connection *client; | 605 | struct GNUNET_CLIENT_Connection *client; |
619 | 606 | ||
620 | LOG (GNUNET_ERROR_TYPE_INFO, _("Stopping service `%s' within %llu ms\n"), | 607 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
621 | service_name, (unsigned long long) timeout.rel_value); | 608 | "Stopping service `%s' within %s\n", |
609 | service_name, | ||
610 | GNUNET_STRINGS_relative_time_to_string (timeout)); | ||
622 | if (h->client == NULL) | 611 | if (h->client == NULL) |
623 | { | 612 | { |
624 | client = GNUNET_CLIENT_connect ("arm", h->cfg); | 613 | client = GNUNET_CLIENT_connect ("arm", h->cfg); |
@@ -690,8 +679,7 @@ handle_list_response (void *cls, const struct GNUNET_MessageHeader *msg) | |||
690 | 679 | ||
691 | if (NULL == msg) | 680 | if (NULL == msg) |
692 | { | 681 | { |
693 | LOG (GNUNET_ERROR_TYPE_WARNING, | 682 | GNUNET_break (0); |
694 | "Error receiving response to LIST request from ARM\n"); | ||
695 | GNUNET_CLIENT_disconnect (sc->h->client); | 683 | GNUNET_CLIENT_disconnect (sc->h->client); |
696 | sc->h->client = GNUNET_CLIENT_connect ("arm", sc->h->cfg); | 684 | sc->h->client = GNUNET_CLIENT_connect ("arm", sc->h->cfg); |
697 | GNUNET_assert (NULL != sc->h->client); | 685 | GNUNET_assert (NULL != sc->h->client); |
@@ -766,13 +754,10 @@ GNUNET_ARM_list_running_services (struct GNUNET_ARM_Handle *h, | |||
766 | client = GNUNET_CLIENT_connect ("arm", h->cfg); | 754 | client = GNUNET_CLIENT_connect ("arm", h->cfg); |
767 | if (client == NULL) | 755 | if (client == NULL) |
768 | { | 756 | { |
769 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 757 | GNUNET_break (0); |
770 | "arm_api, GNUNET_CLIENT_connect returned NULL\n"); | ||
771 | cb (cb_cls, GNUNET_ARM_PROCESS_COMMUNICATION_ERROR, 0, NULL); | 758 | cb (cb_cls, GNUNET_ARM_PROCESS_COMMUNICATION_ERROR, 0, NULL); |
772 | return; | 759 | return; |
773 | } | 760 | } |
774 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
775 | "arm_api, GNUNET_CLIENT_connect returned non-NULL\n"); | ||
776 | h->client = client; | 761 | h->client = client; |
777 | } | 762 | } |
778 | 763 | ||
@@ -785,8 +770,8 @@ GNUNET_ARM_list_running_services (struct GNUNET_ARM_Handle *h, | |||
785 | msg.type = htons (GNUNET_MESSAGE_TYPE_ARM_LIST); | 770 | msg.type = htons (GNUNET_MESSAGE_TYPE_ARM_LIST); |
786 | 771 | ||
787 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 772 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
788 | "Requesting LIST from ARM service with timeout: %llu ms\n", | 773 | "Requesting LIST from ARM service with timeout: %s\n", |
789 | (unsigned long long)timeout.rel_value); | 774 | GNUNET_STRINGS_relative_time_to_string (timeout)); |
790 | 775 | ||
791 | if (GNUNET_OK != | 776 | if (GNUNET_OK != |
792 | GNUNET_CLIENT_transmit_and_get_response (sctx->h->client, | 777 | GNUNET_CLIENT_transmit_and_get_response (sctx->h->client, |
@@ -797,8 +782,7 @@ GNUNET_ARM_list_running_services (struct GNUNET_ARM_Handle *h, | |||
797 | &handle_list_response, | 782 | &handle_list_response, |
798 | sctx)) | 783 | sctx)) |
799 | { | 784 | { |
800 | LOG (GNUNET_ERROR_TYPE_WARNING, | 785 | GNUNET_break (0); |
801 | "Error while trying to transmit request to list services to ARM\n"); | ||
802 | if (cb != NULL) | 786 | if (cb != NULL) |
803 | cb (cb_cls, GNUNET_SYSERR, 0, NULL); | 787 | cb (cb_cls, GNUNET_SYSERR, 0, NULL); |
804 | GNUNET_free (sctx); | 788 | GNUNET_free (sctx); |
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c index d84de1c7a..c155577d0 100644 --- a/src/arm/gnunet-arm.c +++ b/src/arm/gnunet-arm.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2009, 2012 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -125,7 +125,6 @@ static unsigned int phase; | |||
125 | */ | 125 | */ |
126 | static struct GNUNET_TIME_Relative timeout; | 126 | static struct GNUNET_TIME_Relative timeout; |
127 | 127 | ||
128 | |||
129 | /** | 128 | /** |
130 | * Do we want to give our stdout to gnunet-service-arm? | 129 | * Do we want to give our stdout to gnunet-service-arm? |
131 | */ | 130 | */ |
@@ -136,6 +135,7 @@ static unsigned int no_stdout = 0; | |||
136 | */ | 135 | */ |
137 | static unsigned int no_stderr = 0; | 136 | static unsigned int no_stderr = 0; |
138 | 137 | ||
138 | |||
139 | /** | 139 | /** |
140 | * Main continuation-passing-style loop. Runs the various | 140 | * Main continuation-passing-style loop. Runs the various |
141 | * jobs that we've been asked to do in order. | 141 | * jobs that we've been asked to do in order. |
@@ -210,6 +210,7 @@ confirm_cb (void *cls, | |||
210 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 210 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
211 | } | 211 | } |
212 | 212 | ||
213 | |||
213 | /** | 214 | /** |
214 | * Callback invoked with the list of running services. | 215 | * Callback invoked with the list of running services. |
215 | * Reports to the user and then runs the next phase in the FSM. | 216 | * Reports to the user and then runs the next phase in the FSM. |
@@ -234,6 +235,7 @@ list_cb (void *cls, int result, unsigned int count, const char *const*list) | |||
234 | FPRINTF (stdout, "%s\n", list[i]); | 235 | FPRINTF (stdout, "%s\n", list[i]); |
235 | } | 236 | } |
236 | 237 | ||
238 | |||
237 | /** | 239 | /** |
238 | * Main function that will be run by the scheduler. | 240 | * Main function that will be run by the scheduler. |
239 | * | 241 | * |
@@ -250,25 +252,23 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
250 | config_file = cfgfile; | 252 | config_file = cfgfile; |
251 | if (GNUNET_CONFIGURATION_get_value_string | 253 | if (GNUNET_CONFIGURATION_get_value_string |
252 | (cfg, "PATHS", "SERVICEHOME", &dir) != GNUNET_OK) | 254 | (cfg, "PATHS", "SERVICEHOME", &dir) != GNUNET_OK) |
253 | { | 255 | { |
254 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 256 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
255 | _ | 257 | "PATHS", "SERVICEHOME"); |
256 | ("Fatal configuration error: `%s' option in section `%s' missing.\n"), | 258 | return; |
257 | "SERVICEHOME", "PATHS"); | ||
258 | return; | ||
259 | } | ||
260 | h = GNUNET_ARM_connect (cfg, NULL); | ||
261 | if (h == NULL) | ||
262 | { | ||
263 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
264 | _("Fatal error initializing ARM API.\n")); | ||
265 | ret = 1; | ||
266 | return; | ||
267 | } | 259 | } |
260 | if (NULL == (h = GNUNET_ARM_connect (cfg, NULL))) | ||
261 | { | ||
262 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
263 | _("Fatal error initializing ARM API.\n")); | ||
264 | ret = 1; | ||
265 | return; | ||
266 | } | ||
268 | GNUNET_SCHEDULER_add_continuation (&cps_loop, NULL, | 267 | GNUNET_SCHEDULER_add_continuation (&cps_loop, NULL, |
269 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 268 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
270 | } | 269 | } |
271 | 270 | ||
271 | |||
272 | /** | 272 | /** |
273 | * Attempts to delete configuration file and SERVICEHOME | 273 | * Attempts to delete configuration file and SERVICEHOME |
274 | * on arm shutdown provided the end and delete options | 274 | * on arm shutdown provided the end and delete options |
@@ -295,6 +295,7 @@ delete_files () | |||
295 | } | 295 | } |
296 | } | 296 | } |
297 | 297 | ||
298 | |||
298 | /** | 299 | /** |
299 | * Main continuation-passing-style loop. Runs the various | 300 | * Main continuation-passing-style loop. Runs the various |
300 | * jobs that we've been asked to do in order. | 301 | * jobs that we've been asked to do in order. |
@@ -306,99 +307,98 @@ static void | |||
306 | cps_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 307 | cps_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
307 | { | 308 | { |
308 | while (1) | 309 | while (1) |
310 | { | ||
311 | switch (phase++) | ||
309 | { | 312 | { |
310 | switch (phase++) | 313 | case 0: |
314 | if (NULL != term) | ||
315 | { | ||
316 | GNUNET_ARM_stop_service (h, term, | ||
317 | (0 == | ||
318 | timeout.rel_value) ? STOP_TIMEOUT : | ||
319 | timeout, &confirm_cb, term); | ||
320 | return; | ||
321 | } | ||
322 | break; | ||
323 | case 1: | ||
324 | if ((end) || (restart)) | ||
325 | { | ||
326 | GNUNET_ARM_stop_service (h, "arm", | ||
327 | (0 == | ||
328 | timeout.rel_value) ? STOP_TIMEOUT_ARM | ||
329 | : timeout, &confirm_cb, "arm"); | ||
330 | return; | ||
331 | } | ||
332 | break; | ||
333 | case 2: | ||
334 | if (start) | ||
335 | { | ||
336 | GNUNET_ARM_start_service (h, "arm", | ||
337 | (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) | | ||
338 | (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR), | ||
339 | (0 == | ||
340 | timeout.rel_value) ? START_TIMEOUT : | ||
341 | timeout, &confirm_cb, "arm"); | ||
342 | return; | ||
343 | } | ||
344 | break; | ||
345 | case 3: | ||
346 | if (NULL != init) | ||
347 | { | ||
348 | GNUNET_ARM_start_service (h, init, | ||
349 | (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) | | ||
350 | (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR), | ||
351 | (0 == | ||
352 | timeout.rel_value) ? START_TIMEOUT : | ||
353 | timeout, &confirm_cb, init); | ||
354 | return; | ||
355 | } | ||
356 | break; | ||
357 | case 4: | ||
358 | if (restart) | ||
359 | { | ||
360 | GNUNET_ARM_disconnect (h); | ||
361 | phase = 0; | ||
362 | end = 0; | ||
363 | start = 1; | ||
364 | restart = 0; | ||
365 | if (NULL == (h = GNUNET_ARM_connect (cfg, NULL))) | ||
311 | { | 366 | { |
312 | case 0: | 367 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
313 | if (term != NULL) | 368 | _("Fatal error initializing ARM API.\n")); |
314 | { | 369 | ret = 1; |
315 | GNUNET_ARM_stop_service (h, term, | ||
316 | (0 == | ||
317 | timeout.rel_value) ? STOP_TIMEOUT : | ||
318 | timeout, &confirm_cb, term); | ||
319 | return; | ||
320 | } | ||
321 | break; | ||
322 | case 1: | ||
323 | if ((end) || (restart)) | ||
324 | { | ||
325 | GNUNET_ARM_stop_service (h, "arm", | ||
326 | (0 == | ||
327 | timeout.rel_value) ? STOP_TIMEOUT_ARM | ||
328 | : timeout, &confirm_cb, "arm"); | ||
329 | return; | ||
330 | } | ||
331 | break; | ||
332 | case 2: | ||
333 | if (start) | ||
334 | { | ||
335 | GNUNET_ARM_start_service (h, "arm", | ||
336 | (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) | | ||
337 | (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR), | ||
338 | (0 == | ||
339 | timeout.rel_value) ? START_TIMEOUT : | ||
340 | timeout, &confirm_cb, "arm"); | ||
341 | return; | ||
342 | } | ||
343 | break; | ||
344 | case 3: | ||
345 | if (init != NULL) | ||
346 | { | ||
347 | GNUNET_ARM_start_service (h, init, | ||
348 | (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) | | ||
349 | (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR), | ||
350 | (0 == | ||
351 | timeout.rel_value) ? START_TIMEOUT : | ||
352 | timeout, &confirm_cb, init); | ||
353 | return; | ||
354 | } | ||
355 | break; | ||
356 | case 4: | ||
357 | if (restart) | ||
358 | { | ||
359 | GNUNET_ARM_disconnect (h); | ||
360 | phase = 0; | ||
361 | end = 0; | ||
362 | start = 1; | ||
363 | restart = 0; | ||
364 | h = GNUNET_ARM_connect (cfg, NULL); | ||
365 | if (NULL == h) | ||
366 | { | ||
367 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
368 | _("Fatal error initializing ARM API.\n")); | ||
369 | ret = 1; | ||
370 | return; | ||
371 | } | ||
372 | GNUNET_SCHEDULER_add_now (&cps_loop, NULL); | ||
373 | return; | ||
374 | } | ||
375 | break; | ||
376 | case 5: | ||
377 | if (list) { | ||
378 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
379 | "Going to list all running services controlled by ARM.\n"); | ||
380 | |||
381 | if (NULL == h) | ||
382 | { | ||
383 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
384 | _("Fatal error initializing ARM API.\n")); | ||
385 | return; | ||
386 | } | ||
387 | |||
388 | GNUNET_ARM_list_running_services (h, | ||
389 | (0 == | ||
390 | timeout.rel_value) ? LIST_TIMEOUT : | ||
391 | timeout, &list_cb, NULL); | ||
392 | return; | ||
393 | } | ||
394 | /* Fall through */ | ||
395 | default: /* last phase */ | ||
396 | GNUNET_ARM_disconnect (h); | ||
397 | if ((end == GNUNET_YES) && (delete == GNUNET_YES)) | ||
398 | delete_files (); | ||
399 | return; | 370 | return; |
400 | } | 371 | } |
372 | GNUNET_SCHEDULER_add_now (&cps_loop, NULL); | ||
373 | return; | ||
374 | } | ||
375 | break; | ||
376 | case 5: | ||
377 | if (list) | ||
378 | { | ||
379 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
380 | "Going to list all running services controlled by ARM.\n"); | ||
381 | |||
382 | if (NULL == h) | ||
383 | { | ||
384 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
385 | _("Fatal error initializing ARM API.\n")); | ||
386 | return; | ||
387 | } | ||
388 | GNUNET_ARM_list_running_services (h, | ||
389 | (0 == | ||
390 | timeout.rel_value) ? LIST_TIMEOUT : | ||
391 | timeout, &list_cb, NULL); | ||
392 | return; | ||
393 | } | ||
394 | /* Fall through */ | ||
395 | default: /* last phase */ | ||
396 | GNUNET_ARM_disconnect (h); | ||
397 | if ((end == GNUNET_YES) && (delete == GNUNET_YES)) | ||
398 | delete_files (); | ||
399 | return; | ||
401 | } | 400 | } |
401 | } | ||
402 | } | 402 | } |
403 | 403 | ||
404 | 404 | ||
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 00dda263e..dab38eaf3 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c | |||
@@ -1122,11 +1122,12 @@ setup_service (void *cls, const char *section) | |||
1122 | &config)) || | 1122 | &config)) || |
1123 | (0 != STAT (config, &sbuf))) | 1123 | (0 != STAT (config, &sbuf))) |
1124 | { | 1124 | { |
1125 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1125 | if (NULL == config) |
1126 | _ | 1126 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, section, "CONFIG"); |
1127 | ("Configuration file `%s' for service `%s' not valid: %s\n"), | 1127 | else |
1128 | config, section, | 1128 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, |
1129 | (config == NULL) ? _("option missing") : STRERROR (errno)); | 1129 | section, "CONFIG", |
1130 | STRERROR (errno)); | ||
1130 | GNUNET_free (binary); | 1131 | GNUNET_free (binary); |
1131 | GNUNET_free_non_null (config); | 1132 | GNUNET_free_non_null (config); |
1132 | return; | 1133 | return; |
diff --git a/src/chat/chat.c b/src/chat/chat.c index d7ebd79b8..26f8f2e38 100644 --- a/src/chat/chat.c +++ b/src/chat/chat.c | |||
@@ -468,9 +468,8 @@ init_private_key (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
468 | if (GNUNET_OK != | 468 | if (GNUNET_OK != |
469 | GNUNET_CONFIGURATION_get_value_filename (cfg, "chat", "HOME", &home)) | 469 | GNUNET_CONFIGURATION_get_value_filename (cfg, "chat", "HOME", &home)) |
470 | { | 470 | { |
471 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 471 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
472 | _("Configuration option `%s' in section `%s' missing\n"), | 472 | "chat", "HOME"); |
473 | "HOME", "chat"); | ||
474 | return NULL; | 473 | return NULL; |
475 | } | 474 | } |
476 | GNUNET_DISK_directory_create (home); | 475 | GNUNET_DISK_directory_create (home); |
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 40b4de33e..54414a8b0 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c | |||
@@ -228,10 +228,8 @@ database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
228 | GNUNET_CONFIGURATION_get_value_filename (cfg, "datastore-sqlite", | 228 | GNUNET_CONFIGURATION_get_value_filename (cfg, "datastore-sqlite", |
229 | "FILENAME", &afsdir)) | 229 | "FILENAME", &afsdir)) |
230 | { | 230 | { |
231 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "sqlite", | 231 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
232 | _ | 232 | "datastore-sqlite", "FILENAME"); |
233 | ("Option `%s' in section `%s' missing in configuration!\n"), | ||
234 | "FILENAME", "datastore-sqlite"); | ||
235 | return GNUNET_SYSERR; | 233 | return GNUNET_SYSERR; |
236 | } | 234 | } |
237 | if (GNUNET_OK != GNUNET_DISK_file_test (afsdir)) | 235 | if (GNUNET_OK != GNUNET_DISK_file_test (afsdir)) |
diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c index b24bfbf31..769694f90 100644 --- a/src/dv/test_transport_api_dv.c +++ b/src/dv/test_transport_api_dv.c | |||
@@ -1131,11 +1131,9 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
1131 | (connect_topology_option_modifier_string, "%lf", | 1131 | (connect_topology_option_modifier_string, "%lf", |
1132 | &connect_topology_option_modifier) != 1) | 1132 | &connect_topology_option_modifier) != 1) |
1133 | { | 1133 | { |
1134 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1134 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, |
1135 | _ | 1135 | "testing", "connect_topology_option_modifier", |
1136 | ("Invalid value `%s' for option `%s' in section `%s': expected float\n"), | 1136 | "expected float"); |
1137 | connect_topology_option_modifier_string, | ||
1138 | "connect_topology_option_modifier", "TESTING"); | ||
1139 | } | 1137 | } |
1140 | GNUNET_free (connect_topology_option_modifier_string); | 1138 | GNUNET_free (connect_topology_option_modifier_string); |
1141 | } | 1139 | } |
diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c index 29cef7472..af1200dc4 100644 --- a/src/fs/fs_namespace.c +++ b/src/fs/fs_namespace.c | |||
@@ -53,9 +53,8 @@ get_namespace_directory (struct GNUNET_FS_Handle *h) | |||
53 | GNUNET_CONFIGURATION_get_value_filename (h->cfg, "FS", "IDENTITY_DIR", | 53 | GNUNET_CONFIGURATION_get_value_filename (h->cfg, "FS", "IDENTITY_DIR", |
54 | &dn)) | 54 | &dn)) |
55 | { | 55 | { |
56 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 56 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
57 | _("Configuration fails to specify `%s' in section `%s'\n"), | 57 | "fs", "IDENTITY_DIR"); |
58 | "IDENTITY_DIR", "fs"); | ||
59 | return NULL; | 58 | return NULL; |
60 | } | 59 | } |
61 | return dn; | 60 | return dn; |
@@ -79,9 +78,8 @@ get_update_information_directory (struct GNUNET_FS_Namespace *ns) | |||
79 | GNUNET_CONFIGURATION_get_value_filename (ns->h->cfg, "FS", "UPDATE_DIR", | 78 | GNUNET_CONFIGURATION_get_value_filename (ns->h->cfg, "FS", "UPDATE_DIR", |
80 | &dn)) | 79 | &dn)) |
81 | { | 80 | { |
82 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 81 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
83 | _("Configuration fails to specify `%s' in section `%s'\n"), | 82 | "fs", "UPDATE_DIR"); |
84 | "UPDATE_DIR", "fs"); | ||
85 | return NULL; | 83 | return NULL; |
86 | } | 84 | } |
87 | GNUNET_asprintf (&ret, "%s%s%s", dn, DIR_SEPARATOR_STR, ns->name); | 85 | GNUNET_asprintf (&ret, "%s%s%s", dn, DIR_SEPARATOR_STR, ns->name); |
diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c index 60dd1c131..7bd8316ab 100644 --- a/src/fs/gnunet-service-fs_indexing.c +++ b/src/fs/gnunet-service-fs_indexing.c | |||
@@ -109,9 +109,8 @@ write_index_list () | |||
109 | if (GNUNET_OK != | 109 | if (GNUNET_OK != |
110 | GNUNET_CONFIGURATION_get_value_filename (cfg, "FS", "INDEXDB", &fn)) | 110 | GNUNET_CONFIGURATION_get_value_filename (cfg, "FS", "INDEXDB", &fn)) |
111 | { | 111 | { |
112 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 112 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
113 | _("Configuration option `%s' in section `%s' missing.\n"), | 113 | "fs", "INDEXDB"); |
114 | "INDEXDB", "FS"); | ||
115 | return; | 114 | return; |
116 | } | 115 | } |
117 | wh = GNUNET_BIO_write_open (fn); | 116 | wh = GNUNET_BIO_write_open (fn); |
@@ -159,9 +158,8 @@ read_index_list () | |||
159 | if (GNUNET_OK != | 158 | if (GNUNET_OK != |
160 | GNUNET_CONFIGURATION_get_value_filename (cfg, "FS", "INDEXDB", &fn)) | 159 | GNUNET_CONFIGURATION_get_value_filename (cfg, "FS", "INDEXDB", &fn)) |
161 | { | 160 | { |
162 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 161 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
163 | _("Configuration option `%s' in section `%s' missing.\n"), | 162 | "fs", "INDEXDB"); |
164 | "INDEXDB", "FS"); | ||
165 | return; | 163 | return; |
166 | } | 164 | } |
167 | if (GNUNET_NO == GNUNET_DISK_file_test (fn)) | 165 | if (GNUNET_NO == GNUNET_DISK_file_test (fn)) |
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index cbe5a3e24..72babdb05 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c | |||
@@ -1597,19 +1597,15 @@ GSF_pending_request_init_ () | |||
1597 | "MAX_PENDING_REQUESTS", | 1597 | "MAX_PENDING_REQUESTS", |
1598 | &max_pending_requests)) | 1598 | &max_pending_requests)) |
1599 | { | 1599 | { |
1600 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1600 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_INFO, |
1601 | _ | 1601 | "fs", "MAX_PENDING_REQUESTS"); |
1602 | ("Configuration fails to specify `%s', assuming default value."), | ||
1603 | "MAX_PENDING_REQUESTS"); | ||
1604 | } | 1602 | } |
1605 | if (GNUNET_OK != | 1603 | if (GNUNET_OK != |
1606 | GNUNET_CONFIGURATION_get_value_size (GSF_cfg, "ats", "WAN_QUOTA_OUT", | 1604 | GNUNET_CONFIGURATION_get_value_size (GSF_cfg, "ats", "WAN_QUOTA_OUT", |
1607 | &bps)) | 1605 | &bps)) |
1608 | { | 1606 | { |
1609 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1607 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_INFO, |
1610 | _ | 1608 | "ats", "WAN_QUOTA_OUT"); |
1611 | ("Configuration fails to specify `%s', assuming default value."), | ||
1612 | "WAN_QUOTA_OUT"); | ||
1613 | bps = 65536; | 1609 | bps = 65536; |
1614 | } | 1610 | } |
1615 | /* queue size should be #queries we can have pending and satisfy within | 1611 | /* queue size should be #queries we can have pending and satisfy within |
diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c index aaf7ca8a3..936cf5164 100644 --- a/src/fs/gnunet-service-fs_push.c +++ b/src/fs/gnunet-service-fs_push.c | |||
@@ -624,10 +624,9 @@ GSF_push_init_ () | |||
624 | GNUNET_CONFIGURATION_get_value_time (GSF_cfg, "fs", "MIN_MIGRATION_DELAY", | 624 | GNUNET_CONFIGURATION_get_value_time (GSF_cfg, "fs", "MIN_MIGRATION_DELAY", |
625 | &min_migration_delay)) | 625 | &min_migration_delay)) |
626 | { | 626 | { |
627 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 627 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, |
628 | _ | 628 | "fs", "MIN_MIGRATION_DELAY", |
629 | ("Invalid value specified for option `%s' in section `%s', content pushing disabled\n"), | 629 | _("time required, content pushing disabled")); |
630 | "MIN_MIGRATION_DELAY", "fs"); | ||
631 | return; | 630 | return; |
632 | } | 631 | } |
633 | consider_gathering (); | 632 | consider_gathering (); |
diff --git a/src/gns/gnunet-gns-fcfsd.c b/src/gns/gnunet-gns-fcfsd.c index 7ef066957..5503000ac 100644 --- a/src/gns/gnunet-gns-fcfsd.c +++ b/src/gns/gnunet-gns-fcfsd.c | |||
@@ -888,11 +888,9 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
888 | "HTTPPORT", | 888 | "HTTPPORT", |
889 | &port)) | 889 | &port)) |
890 | { | 890 | { |
891 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 891 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
892 | _("Option `%s' not specified in configuration section `%s'\n"), | 892 | "fcfsd", "HTTPPORT"); |
893 | "HTTPPORT", | 893 | return; |
894 | "fcfsd"); | ||
895 | return; | ||
896 | } | 894 | } |
897 | if (GNUNET_OK != | 895 | if (GNUNET_OK != |
898 | GNUNET_CONFIGURATION_get_value_filename (cfg, | 896 | GNUNET_CONFIGURATION_get_value_filename (cfg, |
@@ -900,10 +898,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
900 | "ZONEKEY", | 898 | "ZONEKEY", |
901 | &keyfile)) | 899 | &keyfile)) |
902 | { | 900 | { |
903 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 901 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
904 | _("Option `%s' not specified in configuration section `%s'\n"), | 902 | "fcfsd", "ZONEKEY"); |
905 | "ZONEKEY", | ||
906 | "fcfsd"); | ||
907 | return; | 903 | return; |
908 | } | 904 | } |
909 | fcfs_zone_pkey = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); | 905 | fcfs_zone_pkey = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); |
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 60bf191c6..bba5152c5 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -322,6 +322,8 @@ int | |||
322 | GNUNET_get_log_call_status (int caller_level, const char *comp, | 322 | GNUNET_get_log_call_status (int caller_level, const char *comp, |
323 | const char *file, const char *function, int line); | 323 | const char *file, const char *function, int line); |
324 | #endif | 324 | #endif |
325 | |||
326 | |||
325 | /** | 327 | /** |
326 | * Main log function. | 328 | * Main log function. |
327 | * | 329 | * |
@@ -400,6 +402,34 @@ GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, const char *comp, | |||
400 | 402 | ||
401 | 403 | ||
402 | /** | 404 | /** |
405 | * Log error message about missing configuration option. | ||
406 | * | ||
407 | * @param kind log level | ||
408 | * @param section section with missing option | ||
409 | * @param option name of missing option | ||
410 | */ | ||
411 | void | ||
412 | GNUNET_log_config_missing (enum GNUNET_ErrorType kind, | ||
413 | const char *section, | ||
414 | const char *option); | ||
415 | |||
416 | |||
417 | /** | ||
418 | * Log error message about invalid configuration option value. | ||
419 | * | ||
420 | * @param kind log level | ||
421 | * @param section section with invalid option | ||
422 | * @param option name of invalid option | ||
423 | * @param required what is required that is invalid about the option | ||
424 | */ | ||
425 | void | ||
426 | GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, | ||
427 | const char *section, | ||
428 | const char *option, | ||
429 | const char *required); | ||
430 | |||
431 | |||
432 | /** | ||
403 | * Abort the process, generate a core dump if possible. | 433 | * Abort the process, generate a core dump if possible. |
404 | */ | 434 | */ |
405 | void | 435 | void |
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index fbb242569..94303a9e2 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c | |||
@@ -617,9 +617,8 @@ testservice_task (void *cls, | |||
617 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", | 617 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", |
618 | "ZONEKEY", &keyfile)) | 618 | "ZONEKEY", &keyfile)) |
619 | { | 619 | { |
620 | fprintf (stderr, | 620 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
621 | _("Option `%s' not given, but I need a zone key file!\n"), | 621 | "gns", "ZONEKEY"); |
622 | "z"); | ||
623 | return; | 622 | return; |
624 | } | 623 | } |
625 | fprintf (stderr, | 624 | fprintf (stderr, |
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index ef1f9b8e3..569f10f5b 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c | |||
@@ -199,10 +199,9 @@ database_setup (struct Plugin *plugin) | |||
199 | if (GNUNET_OK != | 199 | if (GNUNET_OK != |
200 | GNUNET_CONFIGURATION_get_value_filename (plugin->cfg, "namestore-sqlite", | 200 | GNUNET_CONFIGURATION_get_value_filename (plugin->cfg, "namestore-sqlite", |
201 | "FILENAME", &afsdir)) | 201 | "FILENAME", &afsdir)) |
202 | { | 202 | { |
203 | LOG (GNUNET_ERROR_TYPE_ERROR, | 203 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
204 | _ ("Option `%s' in section `%s' missing in configuration!\n"), | 204 | "namestore-sqlite", "FILENAME"); |
205 | "FILENAME", "namestore-sqlite"); | ||
206 | return GNUNET_SYSERR; | 205 | return GNUNET_SYSERR; |
207 | } | 206 | } |
208 | if (GNUNET_OK != GNUNET_DISK_file_test (afsdir)) | 207 | if (GNUNET_OK != GNUNET_DISK_file_test (afsdir)) |
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 3578b9e9b..9bd6d8e19 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c | |||
@@ -1022,9 +1022,8 @@ read_friends_file (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
1022 | if (GNUNET_OK != | 1022 | if (GNUNET_OK != |
1023 | GNUNET_CONFIGURATION_get_value_filename (cfg, "TOPOLOGY", "FRIENDS", &fn)) | 1023 | GNUNET_CONFIGURATION_get_value_filename (cfg, "TOPOLOGY", "FRIENDS", &fn)) |
1024 | { | 1024 | { |
1025 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1025 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
1026 | _("Option `%s' in section `%s' not specified!\n"), "FRIENDS", | 1026 | "topology", "FRIENDS"); |
1027 | "TOPOLOGY"); | ||
1028 | return; | 1027 | return; |
1029 | } | 1028 | } |
1030 | if (GNUNET_OK != GNUNET_DISK_file_test (fn)) | 1029 | if (GNUNET_OK != GNUNET_DISK_file_test (fn)) |
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c index 8b6e45612..505326879 100644 --- a/src/transport/gnunet-service-transport_blacklist.c +++ b/src/transport/gnunet-service-transport_blacklist.c | |||
@@ -230,9 +230,8 @@ read_blacklist_file () | |||
230 | GNUNET_CONFIGURATION_get_value_filename (GST_cfg, "TRANSPORT", | 230 | GNUNET_CONFIGURATION_get_value_filename (GST_cfg, "TRANSPORT", |
231 | "BLACKLIST_FILE", &fn)) | 231 | "BLACKLIST_FILE", &fn)) |
232 | { | 232 | { |
233 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 233 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_DEBUG, |
234 | "Option `%s' in section `%s' not specified!\n", | 234 | "transport", "BLACKLIST_FILE"); |
235 | "BLACKLIST_FILE", "TRANSPORT"); | ||
236 | return; | 235 | return; |
237 | } | 236 | } |
238 | if (GNUNET_OK != GNUNET_DISK_file_test (fn)) | 237 | if (GNUNET_OK != GNUNET_DISK_file_test (fn)) |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 208ddad68..9d23c5121 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -2385,9 +2385,8 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
2385 | GNUNET_CONFIGURATION_get_value_time (env->cfg, "transport-tcp", | 2385 | GNUNET_CONFIGURATION_get_value_time (env->cfg, "transport-tcp", |
2386 | "TIMEOUT", &idle_timeout)) | 2386 | "TIMEOUT", &idle_timeout)) |
2387 | { | 2387 | { |
2388 | LOG (GNUNET_ERROR_TYPE_ERROR, | 2388 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
2389 | _("Failed to find option %s in section %s!\n"), | 2389 | "transport-tcp", "TIMEOUT"); |
2390 | "TIMEOUT", "transport-tcp"); | ||
2391 | if (plugin->nat != NULL) | 2390 | if (plugin->nat != NULL) |
2392 | GNUNET_NAT_unregister (plugin->nat); | 2391 | GNUNET_NAT_unregister (plugin->nat); |
2393 | GNUNET_free (plugin); | 2392 | GNUNET_free (plugin); |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 4ff1b67bf..49fe101b7 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -1691,11 +1691,9 @@ libgnunet_plugin_transport_wlan_init (void *cls) | |||
1691 | GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-wlan", | 1691 | GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-wlan", |
1692 | "TESTMODE", &testmode)) || | 1692 | "TESTMODE", &testmode)) || |
1693 | (testmode > 2) ) ) | 1693 | (testmode > 2) ) ) |
1694 | { | 1694 | { |
1695 | LOG (GNUNET_ERROR_TYPE_ERROR, | 1695 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
1696 | _("Invalid configuration option `%s' in section `%s'\n"), | 1696 | "transport-wlan", "TESTMODE"); |
1697 | "TESTMODE", | ||
1698 | "transport-wlan"); | ||
1699 | return NULL; | 1697 | return NULL; |
1700 | } | 1698 | } |
1701 | if ( (0 == testmode) && | 1699 | if ( (0 == testmode) && |
@@ -1711,10 +1709,8 @@ libgnunet_plugin_transport_wlan_init (void *cls) | |||
1711 | (env->cfg, "transport-wlan", "INTERFACE", | 1709 | (env->cfg, "transport-wlan", "INTERFACE", |
1712 | &interface)) | 1710 | &interface)) |
1713 | { | 1711 | { |
1714 | LOG (GNUNET_ERROR_TYPE_ERROR, | 1712 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
1715 | _("Missing configuration option `%s' in section `%s'\n"), | 1713 | "transport-wlan", "INTERFACE"); |
1716 | "INTERFACE", | ||
1717 | "transport-wlan"); | ||
1718 | return NULL; | 1714 | return NULL; |
1719 | } | 1715 | } |
1720 | 1716 | ||
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 6161d0c6d..23749dd99 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -1190,6 +1190,45 @@ GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen) | |||
1190 | 1190 | ||
1191 | 1191 | ||
1192 | /** | 1192 | /** |
1193 | * Log error message about missing configuration option. | ||
1194 | * | ||
1195 | * @param kind log level | ||
1196 | * @param section section with missing option | ||
1197 | * @param option name of missing option | ||
1198 | */ | ||
1199 | void | ||
1200 | GNUNET_log_config_missing (enum GNUNET_ErrorType kind, | ||
1201 | const char *section, | ||
1202 | const char *option) | ||
1203 | { | ||
1204 | GNUNET_log (kind, | ||
1205 | _("Configuration fails to specify option `%s' in section `%s'!\n"), | ||
1206 | option, | ||
1207 | section); | ||
1208 | } | ||
1209 | |||
1210 | |||
1211 | /** | ||
1212 | * Log error message about invalid configuration option value. | ||
1213 | * | ||
1214 | * @param kind log level | ||
1215 | * @param section section with invalid option | ||
1216 | * @param option name of invalid option | ||
1217 | * @param required what is required that is invalid about the option | ||
1218 | */ | ||
1219 | void | ||
1220 | GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, | ||
1221 | const char *section, | ||
1222 | const char *option, | ||
1223 | const char *required) | ||
1224 | { | ||
1225 | GNUNET_log (kind, | ||
1226 | _("Configuration specifies invalid value for option `%s' in section `%s': %s\n"), | ||
1227 | option, section, required); | ||
1228 | } | ||
1229 | |||
1230 | |||
1231 | /** | ||
1193 | * Initializer | 1232 | * Initializer |
1194 | */ | 1233 | */ |
1195 | void __attribute__ ((constructor)) GNUNET_util_cl_init () | 1234 | void __attribute__ ((constructor)) GNUNET_util_cl_init () |
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index c91153f69..78c93c3b8 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -106,8 +106,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
106 | if (GNUNET_OK != | 106 | if (GNUNET_OK != |
107 | GNUNET_CONFIGURATION_get_value_filename (cfg, section, option, &value)) | 107 | GNUNET_CONFIGURATION_get_value_filename (cfg, section, option, &value)) |
108 | { | 108 | { |
109 | fprintf (stderr, _("No value for option `%s' in section `%s'\n"), | 109 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
110 | option, section); | 110 | section, option); |
111 | ret = 3; | 111 | ret = 3; |
112 | return; | 112 | return; |
113 | } | 113 | } |
@@ -117,8 +117,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
117 | if (GNUNET_OK != | 117 | if (GNUNET_OK != |
118 | GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &value)) | 118 | GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &value)) |
119 | { | 119 | { |
120 | fprintf (stderr, _("No value for option `%s' in section `%s'\n"), | 120 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
121 | option, section); | 121 | section, option); |
122 | ret = 3; | 122 | ret = 3; |
123 | return; | 123 | return; |
124 | } | 124 | } |