diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-04-22 00:20:34 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-04-22 00:20:34 +0000 |
commit | 8f30aa29846673327fd04114d653311963782068 (patch) | |
tree | dbaf6442bfe038629c0c97eef75077d71ebd2ec7 /channels/chan_mgcp.c | |
parent | a4f2d9262e216fe8e8607f8d8d07c08ec87c0149 (diff) |
gethostbyname isn't reentrant, who knew...
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2734 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_mgcp.c')
-rwxr-xr-x | channels/chan_mgcp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index e2cf8e4a6..34344bae2 100755 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -1573,7 +1573,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req) int peercapability, peerNonCodecCapability; struct sockaddr_in sin; char *codecs; - struct hostent *hp; + struct ast_hostent ahp; struct hostent *hp; int codec; int iterator; struct mgcp_endpoint *p = sub->parent; @@ -1590,7 +1590,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req) return -1; } /* XXX This could block for a long time, and block the main thread! XXX */ - hp = gethostbyname(host); + hp = ast_gethostbyname(host, &ahp); if (!hp) { ast_log(LOG_WARNING, "Unable to lookup host in c= line, '%s'\n", c); return -1; @@ -1772,7 +1772,7 @@ static int add_sdp(struct mgcp_request *resp, struct mgcp_subchannel *sub, struc struct sockaddr_in dest; struct mgcp_endpoint *p = sub->parent; /* XXX We break with the "recommendation" and send our IP, in order that our - peer doesn't have to gethostbyname() us XXX */ + peer doesn't have to ast_gethostbyname() us XXX */ len = 0; if (!sub->rtp) { ast_log(LOG_WARNING, "No way to add SDP without an RTP structure\n"); @@ -3651,7 +3651,7 @@ static int reload_config(void) struct mgcp_gateway *g; struct mgcp_endpoint *e; char *cat; - struct hostent *hp; + struct ast_hostent ahp; struct hostent *hp; int format; if (gethostname(ourhost, sizeof(ourhost))) { @@ -3670,7 +3670,7 @@ static int reload_config(void) while(v) { /* Create the interface list */ if (!strcasecmp(v->name, "bindaddr")) { - if (!(hp = gethostbyname(v->value))) { + if (!(hp = ast_gethostbyname(v->value, &ahp))) { ast_log(LOG_WARNING, "Invalid address: %s\n", v->value); } else { memcpy(&bindaddr.sin_addr, hp->h_addr, sizeof(bindaddr.sin_addr)); @@ -3749,7 +3749,7 @@ static int reload_config(void) if (ntohl(bindaddr.sin_addr.s_addr)) { memcpy(&__ourip, &bindaddr.sin_addr, sizeof(__ourip)); } else { - hp = gethostbyname(ourhost); + hp = ast_gethostbyname(ourhost, &ahp); if (!hp) { ast_log(LOG_WARNING, "Unable to get our IP address, MGCP disabled\n"); ast_destroy(cfg); |