rwrap: AIX compatibility fix, missing headers, bad directive
authorGuillaume Xavier Taillon <gtaillon@ca.ibm.com>
Tue, 1 Mar 2016 16:13:34 +0000 (11:13 -0500)
committerAndreas Schneider <asn@samba.org>
Wed, 2 Mar 2016 12:08:24 +0000 (13:08 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11765

Signed-off-by: Guillaume Xavier Taillon <gtaillon@ca.ibm.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
ConfigureChecks.cmake
config.h.cmake
src/resolv_wrapper.c

index be2f04c..44de342 100644 (file)
@@ -49,6 +49,7 @@ endif(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW AND NOT OS2)
 # HEADERS
 check_include_file(sys/types.h HAVE_SYS_TYPES_H)
 check_include_file(resolv.h HAVE_RESOLV_H)
+check_include_file(arpa/nameser.h HAVE_ARPA_NAMESER_H)
 
 # FUNCTIONS
 set(CMAKE_REQUIRED_LIBRARIES)
index 31e2855..adc7870 100644 (file)
@@ -15,6 +15,7 @@
 /************************** HEADER FILES *************************/
 
 #cmakedefine HAVE_SYS_TYPES_H 1
+#cmakedefine HAVE_ARPA_NAMESER_H 1
 
 /*************************** FUNCTIONS ***************************/
 
index 77baa45..72005fa 100644 (file)
 
 #include <errno.h>
 #include <arpa/inet.h>
+#ifdef HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif /* HAVE_ARPA_NAMESER_H */
 #include <netinet/in.h>
+#include <sys/socket.h>
 #include <sys/types.h>
 #include <stdarg.h>
 #include <stdlib.h>
@@ -1421,8 +1425,8 @@ static int rwrap_res_ninit(struct __res_state *state)
                        state->nscount = 0;
                        memset(state->nsaddr_list, 0, sizeof(state->nsaddr_list));
 
-                       state->_u._ext.nscount = 0;
 #ifdef HAVE_RESOLV_IPV6_NSADDRS
+                       state->_u._ext.nscount = 0;
                        for (i = 0; i < state->_u._ext.nscount; i++) {
                                SAFE_FREE(state->_u._ext.nsaddrs[i]);
                        }