From cd62e6773d90353b859ae0127fe3e48045efce46 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 26 Sep 2016 16:15:07 +0000 Subject: [PATCH] refuse to run if binds fail --- src/util/service_new.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/util/service_new.c b/src/util/service_new.c index c15d98161..95bdca33b 100644 --- a/src/util/service_new.c +++ b/src/util/service_new.c @@ -1279,13 +1279,25 @@ setup_service (struct GNUNET_SERVICE_Handle *sh) { GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind"); + GNUNET_free (addrs[i++]); GNUNET_free (slc); continue; } + GNUNET_free (addrs[i++]); GNUNET_CONTAINER_DLL_insert (sh->slc_head, sh->slc_tail, slc); } + GNUNET_free_non_null (addrlens); + GNUNET_free_non_null (addrs); + if ( (0 != num) && + (NULL == sh->slc_head) ) + { + /* All attempts to bind failed, hard failure */ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Could not bind to any of the ports I was supposed to, refusing to run!\n")); + return GNUNET_SYSERR; + } } sh->require_found = tolerant ? GNUNET_NO : GNUNET_YES; -- 2.25.1