From d5944e2225f6e27d0b83cd50a117d1b79aa82a53 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 9 Sep 2013 11:55:24 +0200 Subject: misc: Fix compilation on FreeBSD of the example Include netinet/in.h and check for FreeBSD for the gethostbyname_r usage. --- test_apps/tcp.c | 6 ++++-- 1 file 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 #include +#include + #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) -- cgit v1.2.3