aboutsummaryrefslogtreecommitdiffstats
path: root/asterisk.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-04-22 00:20:34 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-04-22 00:20:34 +0000
commit8f30aa29846673327fd04114d653311963782068 (patch)
treedbaf6442bfe038629c0c97eef75077d71ebd2ec7 /asterisk.c
parenta4f2d9262e216fe8e8607f8d8d07c08ec87c0149 (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 'asterisk.c')
-rwxr-xr-xasterisk.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/asterisk.c b/asterisk.c
index bc743be86..eab37a877 100755
--- a/asterisk.c
+++ b/asterisk.c
@@ -46,6 +46,7 @@
#include "editline/histedit.h"
#include "asterisk.h"
#include <asterisk/config.h>
+#include <asterisk/lock.h>
#define AST_MAX_CONNECTS 128
#define NUM_MSGS 64
@@ -1675,3 +1676,15 @@ int main(int argc, char *argv[])
}
return 0;
}
+
+struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
+{
+ int res;
+ int h_errno;
+ struct hostent *result = NULL;
+ /* XXX Does BSD do this differently? XXX */
+ res = gethostbyname_r(host, &hp->hp, hp->buf, sizeof(hp->buf), &result, &h_errno);
+ if (res)
+ return NULL;
+ return &hp->hp;
+}