mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-06 02:22:56 +00:00
support mac
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10903 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
be1bb06be4
commit
e7e94b1d75
@ -36,14 +36,6 @@
|
|||||||
#define closesocket(x) close(x)
|
#define closesocket(x) close(x)
|
||||||
#endif
|
#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 */
|
/* Written by Marc Espie, public domain */
|
||||||
@ -456,7 +448,7 @@ esl_status_t esl_connect(esl_handle_t *handle, const char *host, esl_port_t port
|
|||||||
|
|
||||||
struct hostent *result;
|
struct hostent *result;
|
||||||
char sendbuf[256];
|
char sendbuf[256];
|
||||||
int rval;
|
int rval = 0;
|
||||||
const char *hval;
|
const char *hval;
|
||||||
|
|
||||||
if (!handle->mutex) {
|
if (!handle->mutex) {
|
||||||
@ -476,19 +468,18 @@ esl_status_t esl_connect(esl_handle_t *handle, const char *host, esl_port_t port
|
|||||||
|
|
||||||
memset(&handle->hostent, 0, sizeof(handle->hostent));
|
memset(&handle->hostent, 0, sizeof(handle->hostent));
|
||||||
|
|
||||||
#ifdef HAVE_GETHOSTBYNAME_R_FIVE
|
if ((result = gethostbyname(host))) {
|
||||||
rval = gethostbyname_r(host, &handle->hostent, handle->hostbuf, sizeof(handle->hostbuf), &handle->errnum);
|
handle->hostent = *result;
|
||||||
result = handle->hostent;
|
} else {
|
||||||
#else
|
rval = -1;
|
||||||
rval = gethostbyname_r(host, &handle->hostent, handle->hostbuf, sizeof(handle->hostbuf), &result, &handle->errnum);
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (rval) {
|
if (rval) {
|
||||||
strerror_r(handle->errnum, handle->err, sizeof(handle->err));
|
strerror_r(handle->errnum, handle->err, sizeof(handle->err));
|
||||||
goto fail;
|
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));
|
rval = connect(handle->sock, (struct sockaddr *) &handle->sockaddr, sizeof(handle->sockaddr));
|
||||||
|
|
||||||
|
@ -35,6 +35,10 @@
|
|||||||
#define _ESL_H_
|
#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_copy_string(_x, _y, _z) strncpy(_x, _y, _z - 1)
|
||||||
#define esl_set_string(_x, _y) esl_copy_string(_x, _y, sizeof(_x))
|
#define esl_set_string(_x, _y) esl_copy_string(_x, _y, sizeof(_x))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user