From 689fc02fd2fe37a29301ad9d4ee2b664f0a76f02 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 14 Jul 2016 14:14:15 +0200 Subject: [PATCH] Allow errors while setting up listeners --- src/test/getdns_context_set_listen_addresses.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/getdns_context_set_listen_addresses.c b/src/test/getdns_context_set_listen_addresses.c index 3b05e803..9246b640 100644 --- a/src/test/getdns_context_set_listen_addresses.c +++ b/src/test/getdns_context_set_listen_addresses.c @@ -804,6 +804,8 @@ getdns_return_t getdns_context_set_listen_addresses(getdns_context *context, new_set->count = new_set_count * n_transports; (void) memset(new_set->items, 0, sizeof(listener) * new_set_count * n_transports); + for (i = 0; i < new_set->count; i++) + new_set->items[i].fd = -1; (void) memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; @@ -906,7 +908,7 @@ getdns_return_t getdns_context_set_listen_addresses(getdns_context *context, /* So the event can be rescheduled */ } } - if ((r = add_listeners(new_set))) { + if (r || (r = add_listeners(new_set))) { for (i = 0; i < new_set->count; i++) new_set->items[i].action = to_remove;