gethostbyname isn't reentrant, who knew...

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-04-22 00:20:34 +00:00
parent ca493a14e1
commit d3f9887589
12 changed files with 71 additions and 35 deletions

View File

@@ -1925,7 +1925,7 @@ static struct iax2_user *mysql_user(char *user)
static int create_addr(struct sockaddr_in *sin, int *capability, int *sendani, int *maxtime, char *peer, char *context, int *trunk, int *notransfer, char *secret, int seclen)
{
struct hostent *hp;
struct ast_hostent ahp; struct hostent *hp;
struct iax2_peer *p;
int found=0;
if (sendani)
@@ -1980,7 +1980,7 @@ static int create_addr(struct sockaddr_in *sin, int *capability, int *sendani, i
}
}
if (!p && !found) {
hp = gethostbyname(peer);
hp = ast_gethostbyname(peer, &ahp);
if (hp) {
memcpy(&sin->sin_addr, hp->h_addr, sizeof(sin->sin_addr));
sin->sin_port = htons(IAX_DEFAULT_PORTNO);
@@ -3860,7 +3860,7 @@ static int iax2_register(char *value, int lineno)
char *porta;
char *stringp=NULL;
struct hostent *hp;
struct ast_hostent ahp; struct hostent *hp;
if (!value)
return -1;
strncpy(copy, value, sizeof(copy)-1);
@@ -3882,7 +3882,7 @@ static int iax2_register(char *value, int lineno)
ast_log(LOG_WARNING, "%s is not a valid port number at line %d\n", porta, lineno);
return -1;
}
hp = gethostbyname(hostname);
hp = ast_gethostbyname(hostname, &ahp);
if (!hp) {
ast_log(LOG_WARNING, "Host '%s' not found at line %d\n", hostname, lineno);
return -1;