diff options
author | Mark Spencer <markster@digium.com> | 2004-04-22 00:20:34 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2004-04-22 00:20:34 +0000 |
commit | d3f9887589e9d48753ac83d3b94e82c50c6bd446 (patch) | |
tree | dbaf6442bfe038629c0c97eef75077d71ebd2ec7 /asterisk.c | |
parent | ca493a14e169c6047e0ca2d1fc5447dfc3f5aa4c (diff) |
gethostbyname isn't reentrant, who knew...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'asterisk.c')
-rwxr-xr-x | asterisk.c | 13 |
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; +} |