From 2b696ea05e1f519bb37bed5577da9fcd860ece1b Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 25 Jan 2021 21:00:47 +0100 Subject: [PATCH] Check the return value of catta_simple_poll_get(). This ensures we gracefully handle the case of Catta not being able to bind to the NETLINK_ROUTE socket. --- catta | 2 +- src/discovery.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/catta b/catta index bb142eb2..070b95d7 160000 --- a/catta +++ b/catta @@ -1 +1 @@ -Subproject commit bb142eb202fda78982305d8aeffc4ae5c16ab1ae +Subproject commit 070b95d769cbcbdf0113437a0db92777765474ea diff --git a/src/discovery.c b/src/discovery.c index e144c286..2ac69b36 100644 --- a/src/discovery.c +++ b/src/discovery.c @@ -418,7 +418,14 @@ static void *discovery_loop(void *userdata) { /* Allocate a new server */ int error; - mesh->catta_server = catta_server_new(catta_simple_poll_get(mesh->catta_poll), &config, discovery_server_callback, mesh, &error); + const CattaPoll *poller = catta_simple_poll_get(mesh->catta_poll); + + if(!poller) { + logger(mesh, MESHLINK_ERROR, "Failed to create discovery server: %s\n", catta_strerror(error)); + goto fail; + } + + mesh->catta_server = catta_server_new(poller, &config, discovery_server_callback, mesh, &error); /* Free the configuration data */ catta_server_config_free(&config); -- 2.39.2