nwrap: Prevent compilation failure on machine without IPv4
authorRobin Hack <hack.robin@gmail.com>
Wed, 25 Mar 2015 08:36:10 +0000 (09:36 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 11 Jan 2016 11:25:26 +0000 (12:25 +0100)
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
lib/nss_wrapper/nss_wrapper.c

index 817106435e893b89ab4f7c5df37d883291d81a37..d9363bc1a888dcf8837c4cd5d9b13f76327496cb 100644 (file)
@@ -144,6 +144,12 @@ typedef nss_status_t NSS_STATUS;
 #define SAFE_FREE(x) do { if ((x) != NULL) {free(x); (x)=NULL;} } while(0)
 #endif
 
+#ifdef HAVE_IPV6
+#define NWRAP_INET_ADDRSTRLEN INET6_ADDRSTRLEN
+#else
+#define NWRAP_INET_ADDRSTRLEN INET_ADDRSTRLEN
+#endif
+
 enum nwrap_dbglvl_e {
        NWRAP_LOG_ERROR = 0,
        NWRAP_LOG_WARN,
@@ -2439,7 +2445,7 @@ static struct hostent *nwrap_files_gethostbyaddr(const void *addr,
                                                 socklen_t len, int type)
 {
        struct hostent *he;
-       char ip[INET6_ADDRSTRLEN] = {0};
+       char ip[NWRAP_INET_ADDRSTRLEN] = {0};
        const char *a;
        int i;