rem: if ((!(l->flags&& SI_IS_IP)) && (
add: if ((!(l->flags& SI_IS_IP)) && (
context: static int fix_socket_list(struct socket_info **list){	struct socket_info* si;	struct socket_info* l;	struct socket_info* next;	char* tmp;	int len;	struct hostent* he;	char** h;		/* try to change all the interface names into addresses	 *  --ugly hack */		for (si=*list;si;){		next=si->next;		if (add_interfaces(si->name.s, AF_INET, si->port_no,							si->proto, list)!=-1){			/* success => remove current entry (shift the entire array)*/			sock_listrm(list, si);			free_sock_info(si);		}		si=next;	}	/* get ips & fill the port numbers*/#ifdef EXTRA_DEBUG	DBG("Listening on \n");#endif	for (si=*list;si;si=si->next){		/* fix port number, port_no should be !=0 here */		if (si->port_no==0){#ifdef USE_TLS			si->port_no= (si->proto==PROTO_TLS)?tls_port_no:port_no;#else			si->port_no= port_no;#endif		}		tmp=int2str(si->port_no, &len);		if (len>=MAX_PORT_LEN){			LOG(L_ERR, "ERROR: fix_socket_list: bad port number: %d\n", 						si->port_no);			goto error;		}		si->port_no_str.s=(char*)pkg_malloc(len+1);		if (si->port_no_str.s==0){			LOG(L_ERR, "ERROR: fix_socket_list: out of memory.\n");			goto error;		}		strncpy(si->port_no_str.s, tmp, len+1);		si->port_no_str.len=len;				/* get "official hostnames", all the aliases etc. */		he=resolvehost(si->name.s);		if (he==0){			LOG(L_ERR, "ERROR: fix_socket_list: could not resolve %s\n",					si->name.s);			goto error;		}		/* check if we got the official name */		if (strcasecmp(he->h_name, si->name.s)!=0){			if (add_alias(si->name.s, si->name.len,							si->port_no, si->proto)<0){				LOG(L_ERR, "ERROR: fix_socket_list: add_alias failed\n");			}			/* change the oficial name */			pkg_free(si->name.s);			si->name.s=(char*)pkg_malloc(strlen(he->h_name)+1);			if (si->name.s==0){				LOG(L_ERR,  "ERROR: fix_socket_list: out of memory.\n");				goto error;			}			si->name.len=strlen(he->h_name);			strncpy(si->name.s, he->h_name, si->name.len+1);		}		/* add the aliases*/		for(h=he->h_aliases; h && *h; h++)			if (add_alias(*h, strlen(*h), si->port_no, si->proto)<0){				LOG(L_ERR, "ERROR: fix_socket_list: add_alias failed\n");			}		hostent2ip_addr(&si->address, he, 0); /*convert to ip_addr 														 format*/		if ((tmp=ip_addr2a(&si->address))==0) goto error;		si->address_str.s=(char*)pkg_malloc(strlen(tmp)+1);		if (si->address_str.s==0){			LOG(L_ERR, "ERROR: fix_socket_list: out of memory.\n");			goto error;		}		strncpy(si->address_str.s, tmp, strlen(tmp)+1);		/* set is_ip (1 if name is an ip address, 0 otherwise) */		si->address_str.len=strlen(tmp);		if 	(	(si->address_str.len==si->name.len)&&				(strncasecmp(si->address_str.s, si->name.s,								si->address_str.len)==0)			){				si->flags|=SI_IS_IP;				/* do rev. dns on it (for aliases)*/				he=rev_resolvehost(&si->address);				if (he==0){					LOG(L_WARN, "WARNING: fix_socket_list:"							" could not rev. resolve %s\n",							si->name.s);				}else{					/* add the aliases*/					if (add_alias(he->h_name, strlen(he->h_name),									si->port_no, si->proto)<0){						LOG(L_ERR, "ERROR: fix_socket_list:"									"add_alias failed\n");					}					for(h=he->h_aliases; h && *h; h++)						if (add_alias(*h,strlen(*h),si->port_no,si->proto)<0){							LOG(L_ERR, "ERROR: fix_socket_list:"									" add_alias failed\n");						}				}		}#ifdef EXTRA_DEBUG		printf("              %.*s [%s]:%s\n", si->name.len, 				si->name.s, si->address_str.s, si->port_no_str.s);#endif	}	/* removing duplicate addresses*/	for (si=*list;si; si=si->next){		for (l=si->next;l;){			next=l->next;			if ((si->port_no==l->port_no) &&				(si->address.af==l->address.af) &&				(memcmp(si->address.u.addr, l->address.u.addr, si->address.len)					== 0)				){#ifdef EXTRA_DEBUG				printf("removing duplicate %s [%s] ==  %s [%s]\n",						si->name.s, si->address_str.s,						 l->name.s, l->address_str.s);#endif				/* add the name to the alias list*/				if ((!(l->flags&& SI_IS_IP)) && (						(l->name.len!=si->name.len)||						(strncmp(l->name.s, si->name.s, si->name.len)!=0))					)					add_alias(l->name.s, l->name.len, l->port_no, l->proto);										/* remove l*/				sock_listrm(list, l);				free_sock_info(l);			}			l=next;		}	}	return 0;error:	return -1;}