Allow errors while setting up listeners

This commit is contained in:
Willem Toorop 2016-07-14 14:14:15 +02:00
parent bae426a0e2
commit 689fc02fd2
1 changed files with 3 additions and 1 deletions

View File

@ -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;