aboutsummaryrefslogtreecommitdiffstats
path: root/utils.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-29 17:54:25 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-29 17:54:25 +0000
commitbfb238a356b6a82337eaff1253f78aefb8d055a8 (patch)
tree9088f443fc48f6a71b68f4cfc008cb54c0eb70a9 /utils.c
parent71f15f1b0be635fa086dcbc9bd85f59c328ff2ed (diff)
FreeBSD fix for utils (bug #1949)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3352 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils.c')
-rwxr-xr-xutils.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index 45be32230..63aca4521 100755
--- a/utils.c
+++ b/utils.c
@@ -14,6 +14,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
#include <asterisk/lock.h>
#include <asterisk/utils.h>
@@ -29,6 +30,7 @@ static char b2a[256];
AST_MUTEX_DEFINE_STATIC(__mutex);
+/* Recursive replacement for gethostbyname for BSD-based systems */
static int gethostbyname_r (const char *name, struct hostent *ret, char *buf,
size_t buflen, struct hostent **result,
int *h_errnop)
@@ -126,6 +128,9 @@ static int gethostbyname_r (const char *name, struct hostent *ret, char *buf,
#endif
+/* Recursive thread safe version of gethostbyname that replaces the
+ standard gethostbyname (which is not recursive)
+*/
struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
{
int res;
@@ -328,6 +333,7 @@ static void base64_init(void)
#endif
}
+/* Recursive thread safe replacement of inet_ntoa */
const char *ast_inet_ntoa(char *buf, int bufsiz, struct in_addr ia)
{
return inet_ntop(AF_INET, &ia, buf, bufsiz);