X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Fservice.c;h=c03247a6d8bf203210ded9722bca83ae0eeeed32;hb=8a741e7ef0f3eefbcb8eb990b47df699132b3873;hp=e7d4c1c6fdba166c287af54cd0c0a3ff08294e30;hpb=aeb922926c639ffdd992f96cd125e47bb0e2c301;p=oweals%2Fgnunet.git diff --git a/src/util/service.c b/src/util/service.c index e7d4c1c6f..c03247a6d 100644 --- a/src/util/service.c +++ b/src/util/service.c @@ -26,7 +26,7 @@ #include "platform.h" #include "gnunet_util_lib.h" #include "gnunet_protocols.h" -#include "gnunet_directories.h" +#include "gnunet_constants.h" #include "gnunet_resolver_service.h" #if HAVE_MALLINFO @@ -65,10 +65,11 @@ GNUNET_SPEEDUP_stop_ (void); * * @param list a list of networks * @param add the IP to check (in network byte order) - * @return GNUNET_NO if the IP is not in the list, GNUNET_YES if it it is + * @return #GNUNET_NO if the IP is not in the list, #GNUNET_YES if it it is */ static int -check_ipv4_listed (const struct GNUNET_STRINGS_IPv4NetworkPolicy *list, const struct in_addr *add) +check_ipv4_listed (const struct GNUNET_STRINGS_IPv4NetworkPolicy *list, + const struct in_addr *add) { unsigned int i; @@ -91,10 +92,11 @@ check_ipv4_listed (const struct GNUNET_STRINGS_IPv4NetworkPolicy *list, const st * * @param list a list of networks * @param ip the IP to check (in network byte order) - * @return GNUNET_NO if the IP is not in the list, GNUNET_YES if it it is + * @return #GNUNET_NO if the IP is not in the list, #GNUNET_YES if it it is */ static int -check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list, const struct in6_addr *ip) +check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list, + const struct in6_addr *ip) { unsigned int i; unsigned int j; @@ -1439,12 +1441,24 @@ GNUNET_SERVICE_run (int argc, char *const *argv, HANDLE_ERROR; if (NULL == opt_cfg_fn) opt_cfg_fn = GNUNET_strdup (cfg_fn); - if (GNUNET_YES == - GNUNET_DISK_file_test (opt_cfg_fn)) - (void) GNUNET_CONFIGURATION_load (cfg, opt_cfg_fn); + if (GNUNET_YES == GNUNET_DISK_file_test (opt_cfg_fn)) + { + if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, opt_cfg_fn)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Malformed configuration file `%s', exit ...\n"), + opt_cfg_fn); + goto shutdown; + } + } else { - (void) GNUNET_CONFIGURATION_load (cfg, NULL); + if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, NULL)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Malformed configuration, exit ...\n")); + goto shutdown; + } if (0 != strcmp (opt_cfg_fn, cfg_fn)) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Could not access configuration file `%s'\n"), @@ -1517,7 +1531,7 @@ shutdown: GNUNET_free_non_null (logfile); GNUNET_free_non_null (loglev); GNUNET_free (cfg_fn); - GNUNET_free (opt_cfg_fn); + GNUNET_free_non_null (opt_cfg_fn); GNUNET_free_non_null (sctx.v4_denied); GNUNET_free_non_null (sctx.v6_denied); GNUNET_free_non_null (sctx.v4_allowed);