[Freeswitch-svn] [commit] r10903 - in freeswitch/trunk/libs/esl/src: . include

FreeSWITCH SVN anthm at freeswitch.org
Sun Dec 21 15:31:57 PST 2008


Author: anthm
Date: Sun Dec 21 18:31:57 2008
New Revision: 10903

Log:
support mac

Modified:
   freeswitch/trunk/libs/esl/src/esl.c
   freeswitch/trunk/libs/esl/src/include/esl.h

Modified: freeswitch/trunk/libs/esl/src/esl.c
==============================================================================
--- freeswitch/trunk/libs/esl/src/esl.c	(original)
+++ freeswitch/trunk/libs/esl/src/esl.c	Sun Dec 21 18:31:57 2008
@@ -36,14 +36,6 @@
 #define closesocket(x) close(x)
 #endif
 
-#ifndef HAVE_GETHOSTBYNAME_R
-extern int gethostbyname_r (const char *__name,
-                            struct hostent *__result_buf,
-                            char *__buf, size_t __buflen,
-                            struct hostent **__result,
-                            int *__h_errnump);
-#endif
-
 
 
 /* Written by Marc Espie, public domain */
@@ -456,7 +448,7 @@
 
 	struct hostent *result;
 	char sendbuf[256];
-	int rval;
+	int rval = 0;
 	const char *hval;
 
 	if (!handle->mutex) {
@@ -476,19 +468,18 @@
 
     memset(&handle->hostent, 0, sizeof(handle->hostent));
 
-#ifdef HAVE_GETHOSTBYNAME_R_FIVE
-	rval = gethostbyname_r(host, &handle->hostent, handle->hostbuf, sizeof(handle->hostbuf), &handle->errnum);
-	result = handle->hostent;
-#else
-	rval = gethostbyname_r(host, &handle->hostent, handle->hostbuf, sizeof(handle->hostbuf), &result, &handle->errnum);
-#endif
+	if ((result = gethostbyname(host))) {
+		handle->hostent = *result;
+	} else {
+		rval = -1;
+	}
 	
 	if (rval) {
 		strerror_r(handle->errnum, handle->err, sizeof(handle->err));
 		goto fail;
 	}
 
-	memcpy(&handle->sockaddr.sin_addr, result->h_addr, result->h_length);
+	memcpy(&handle->sockaddr.sin_addr, result->h_addr_list[0], result->h_length);
 	
 	rval = connect(handle->sock, (struct sockaddr *) &handle->sockaddr, sizeof(handle->sockaddr));
 	

Modified: freeswitch/trunk/libs/esl/src/include/esl.h
==============================================================================
--- freeswitch/trunk/libs/esl/src/include/esl.h	(original)
+++ freeswitch/trunk/libs/esl/src/include/esl.h	Sun Dec 21 18:31:57 2008
@@ -35,6 +35,10 @@
 #define _ESL_H_
 
 
+#include <stdarg.h>
+int vasprintf(char **ret, const char *format, va_list ap);
+
+
 #define esl_copy_string(_x, _y, _z) strncpy(_x, _y, _z - 1)
 #define esl_set_string(_x, _y) esl_copy_string(_x, _y, sizeof(_x))
 



More information about the Freeswitch-svn mailing list