aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-09-09 11:55:24 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-09-09 11:55:24 +0200
commitd5944e2225f6e27d0b83cd50a117d1b79aa82a53 (patch)
tree470ec3b127e5a4f4c8c4d1a1524bdfde6eed2234
parentef554d088031cc7255bae7b417ac29c01698f43f (diff)
misc: Fix compilation on FreeBSD of the example
Include netinet/in.h and check for FreeBSD for the gethostbyname_r usage.
-rw-r--r--test_apps/tcp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/test_apps/tcp.c b/test_apps/tcp.c
index ef572df..5733294 100644
--- a/test_apps/tcp.c
+++ b/test_apps/tcp.c
@@ -31,6 +31,8 @@
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
+#include <netinet/in.h>
+
#include "esme.h"
int do_tcp_connect( xmlNodePtr p, int *s )
@@ -38,7 +40,7 @@ int do_tcp_connect( xmlNodePtr p, int *s )
int ret = 0;
int n = 1;
struct hostent _host;
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD__)
struct hostent *__host_result;
#endif
struct in_addr addr;
@@ -61,7 +63,7 @@ int do_tcp_connect( xmlNodePtr p, int *s )
ret = -1; goto lb_tcp_connect_end;
};
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD__)
if( gethostbyname_r(h,&_host,ahost,sizeof(ahost),&__host_result,&n) != 0)
#else /* solaris */
if( gethostbyname_r(h,&_host,ahost,sizeof(ahost),&n) == NULL)