compat_netdb.h is added for only one reason: to provide the definitions
for getaddrinfo, in case it is not provided by the system.
compat_netdb.h is just a copy from an old glibc version, but that makes
it incompatible with other standard C libraries. For example, uClibc
without RPC support doesn't have the rpc/netdb.h header. This leads to
build errors.

To work around this, only include compat_netdb.h when needed, i.e.
when getaddrinfo isn't provided natively.

Note that this getaddrinfo compat was introduced in commit bc54c431 to
support Solaris 7. Starting from Solaris 8, however, getaddrinfo is
available natively, and it's available on MacOS, Windows and any other
POSIX-2001 compliant system as well. So it may be worhtwhile to remove
it altogether.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arn...@mind.be>
---
 module/owlib/src/include/compat.h   | 2 ++
 module/ownet/c/src/include/compat.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/module/owlib/src/include/compat.h 
b/module/owlib/src/include/compat.h
index c55bc96..e95e16f 100644
--- a/module/owlib/src/include/compat.h
+++ b/module/owlib/src/include/compat.h
@@ -57,7 +57,9 @@
 #include <features.h>
 #endif
 
+#ifndef HAVE_GETADDRINFO
 #include "compat_netdb.h"
+#endif
 #include "compat_getopt.h"
 
 #ifndef HAVE_STRSEP
diff --git a/module/ownet/c/src/include/compat.h 
b/module/ownet/c/src/include/compat.h
index c45d852..f8ae759 100644
--- a/module/ownet/c/src/include/compat.h
+++ b/module/ownet/c/src/include/compat.h
@@ -58,7 +58,9 @@ $Id$
 #include <features.h>
 #endif
 
+#ifndef HAVE_GETADDRINFO
 #include "compat_netdb.h"
+#endif
 #include "compat_getopt.h"
 
 #ifndef HAVE_STRSEP
-- 
2.7.0


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to