nwrap: Fix build if system doesn't provide gethostbyname2
authorAndreas Schneider <asn@samba.org>
Mon, 16 Mar 2020 16:43:20 +0000 (17:43 +0100)
committerAndreas Schneider <asn@samba.org>
Mon, 16 Mar 2020 16:44:14 +0000 (17:44 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
src/nss_wrapper.c

index d6639ebf5af6128fc3b8105935927cc7777cc4c1..4c7d36d913611f5519210cd1903333ecf8d173ef 100644 (file)
@@ -512,8 +512,10 @@ static struct hostent *nwrap_files_gethostbyaddr(struct nwrap_backend *b,
                                                 socklen_t len, int type);
 static struct hostent *nwrap_files_gethostbyname(struct nwrap_backend *b,
                                                 const char *name);
+#ifdef HAVE_GETHOSTBYNAME2
 static struct hostent *nwrap_files_gethostbyname2(struct nwrap_backend *b,
                                                  const char *name, int af);
+#endif /* HAVE_GETHOSTBYNAME2 */
 static int nwrap_files_gethostbyname2_r(struct nwrap_backend *b,
                                        const char *name, int af,
                                        struct hostent *hedst,
@@ -589,7 +591,9 @@ struct nwrap_ops nwrap_files_ops = {
        .nw_endgrent    = nwrap_files_endgrent,
        .nw_gethostbyaddr       = nwrap_files_gethostbyaddr,
        .nw_gethostbyname       = nwrap_files_gethostbyname,
+#ifdef HAVE_GETHOSTBYNAME2
        .nw_gethostbyname2      = nwrap_files_gethostbyname2,
+#endif /* HAVE_GETHOSTBYNAME2 */
        .nw_gethostbyname2_r    = nwrap_files_gethostbyname2_r,
 };