ENTRY *p;
struct nwrap_entlist *el;
+ if (ip_addr == NULL) {
+ NWRAP_LOG(NWRAP_LOG_ERROR, "ip_addr NULL - can't add");
+ return false;
+ }
+
el = nwrap_entlist_init(ed);
if (el == NULL) {
return false;
ENTRY *p;
struct nwrap_entlist *el;
+ if (h_name == NULL) {
+ NWRAP_LOG(NWRAP_LOG_ERROR, "h_name NULL - can't add");
+ return false;
+ }
+
el = nwrap_entlist_init(ed);
if (el == NULL) {
return false;
return true;
}
-static void nwrap_add_hname_add_to_existing(struct nwrap_entdata *const ed,
+static bool nwrap_add_hname_add_to_existing(struct nwrap_entdata *const ed,
struct nwrap_entlist *const el)
{
struct nwrap_entlist *cursor;
struct nwrap_entlist *el_new;
+ if (el == NULL) {
+ NWRAP_LOG(NWRAP_LOG_ERROR, "list is NULL, can not add");
+ return false;
+ }
+
el_new = nwrap_entlist_init(ed);
if (el_new == NULL) {
- return;
+ return false;
}
for (cursor = el; cursor->next != NULL; cursor = cursor->next)
{
if (cursor->ed == ed) {
free(el_new);
- return;
+ return false;
}
}
if (cursor->ed == ed) {
free(el_new);
- return;
+ return false;
}
cursor->next = el_new;
+ return true;
}
static bool nwrap_add_hname_alias(char *const h_name_a,
struct hostent *result,
struct nwrap_vector *addr_list)
{
- struct nwrap_entlist *el_head;
- struct nwrap_entlist *el_cur;
+ struct nwrap_entlist *el;
struct hostent *he;
char *h_name_lower;
ENTRY e;
}
/* Iterate through results */
- el_head = (struct nwrap_entlist *)e_p->data;
- for (el_cur = el_head; el_cur != NULL; el_cur = el_cur->next) {
- he = &(el_cur->ed->ht);
+ for (el = (struct nwrap_entlist *)e_p->data; el != NULL; el = el->next)
+ {
+ he = &(el->ed->ht);
/* Filter by address familiy if provided */
if (af != AF_UNSPEC && he->h_addrtype != af) {
he->h_name);
he_found = true;
}
- nwrap_vector_merge(addr_list, &el_cur->ed->nwrap_addrdata);
+ nwrap_vector_merge(addr_list, &el->ed->nwrap_addrdata);
result->h_addr_list = nwrap_vector_head(addr_list);
}
const struct addrinfo *hints,
struct addrinfo **ai_tail)
{
- struct nwrap_entlist *el_head;
- struct nwrap_entlist *el_cur;
+ struct nwrap_entlist *el;
struct hostent *he;
struct addrinfo *ai = NULL;
struct addrinfo *ai_head = NULL;
NWRAP_LOG(NWRAP_LOG_DEBUG, "Name: %s found.", h_name_lower);
SAFE_FREE(h_name_lower);
- el_head = (struct nwrap_entlist *)e_p->data;
-
- for (el_cur = el_head; el_cur != NULL; el_cur = el_cur->next) {
+ for (el = (struct nwrap_entlist *)e_p->data; el != NULL; el = el->next)
+ {
int rc;
- he = &(el_cur->ed->ht);
+ he = &(el->ed->ht);
if (hints->ai_family != AF_UNSPEC &&
he->h_addrtype != hints->ai_family) {